Skip to content

Conversation

@LeMyst
Copy link

@LeMyst LeMyst commented Jan 20, 2026

This pull request adds a new feature to the Text-to-Speech (TTS) system that allows users to replace underscores in author names with spaces, improving the readability of spoken names. The change includes UI, model, and persistence updates to support this new option.

New feature: Underscore replacement in author names

  • Added _isUnderscoreReplacementEnabled property to TtsModel, with associated getter and setter, and included it in model serialization/deserialization to persist the setting. [1] [2] [3] [4]
  • Modified the logic in TtsModel to replace underscores with spaces in author names when the new setting is enabled.

User interface updates

  • Added a new switch in the TTS settings screen (TextToSpeechScreen) to allow users to toggle the underscore replacement feature.

Introduces a new setting to replace underscores with spaces in author names when generating TTS prelude. Adds a toggle in the TTS settings screen and persists the setting in the TtsModel.
Copilot AI review requested due to automatic review settings January 20, 2026 11:14
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request adds a user-configurable option to replace underscores with spaces in author names when they are spoken by the Text-to-Speech system, improving pronunciation of usernames containing underscores.

Changes:

  • Added a new boolean property _isUnderscoreReplacementEnabled to the TtsModel with getter/setter methods
  • Implemented underscore replacement logic in the getVocalization method for TwitchMessageModel author names
  • Added persistence support through JSON serialization/deserialization
  • Added a UI toggle switch in the TTS settings screen to control this feature

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
lib/models/tts.dart Added the _isUnderscoreReplacementEnabled property, implemented the underscore replacement logic for author names, and included the property in JSON serialization/deserialization
lib/screens/settings/tts.dart Added a new SwitchListTile to allow users to toggle the underscore replacement feature

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +148 to +154
var author = model.author.displayName ?? model.author.login;
if (_isUnderscoreReplacementEnabled) {
author = author
.replaceAll("_", " ")
.replaceAll(RegExp(r'\s+'), ' ')
.trim();
}
Copy link

Copilot AI Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The underscore replacement is only applied to author names in TwitchMessageModel, but not to other event types that also use display names, such as TwitchRaidEventModel (line 169) and TwitchFollowEventModel (line 184). This creates an inconsistent user experience where some spoken names will have underscores replaced and others won't. Consider applying the same transformation to all user display names for consistency.

Copilot uses AI. Check for mistakes.
Copy link
Contributor

@kevmo314 kevmo314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems reasonable but we should always replace underscores if it sounds better, it doesn't need to be a setting.

@LeMyst
Copy link
Author

LeMyst commented Jan 20, 2026

This seems reasonable but we should always replace underscores if it sounds better, it doesn't need to be a setting.

Maybe set it as true as default ? I don't know if there is many users that compained about this;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants