Some fixes for language and voice scripts:

Languages:
  * Get rid of leading space on LANG_ID3_VBR [ " (VBR)" ]
  * Fix up sole user to insert the space programmically
 updatelang:
  * strip leading and trailing spaces on all phrases except VOICE_PAUSE
 voice.pl
  * Debug logging with UTF-8 output
  * Explicitly delete tab character from voiced strings

Change-Id: Ie466793479ce15ce7a9553770583a070530e7afd
This commit is contained in:
Solomon Peachy 2025-04-29 18:49:13 -04:00
parent 0ea02f0268
commit 12b9419006
47 changed files with 110 additions and 106 deletions

View file

@ -91,6 +91,7 @@
# GoGear SA9200 gogearsa9200
# Samsung
# YH820/YH920/YH925 samsungyh*
# First item will be shown when P2STR is passed a NULL pointer
<phrase>
id: LANG_ROCKBOX_TITLE
desc: main menu title
@ -105,7 +106,6 @@
*: "Rockbox"
</voice>
</phrase>
# First item will be shown when P2STR is passed a NULL pointer
<phrase>
id: LANG_SET_BOOL_YES
desc: bool true representation
@ -3524,18 +3524,15 @@
user: core
<source>
*: none
battery_types: ""
xduoox3: ""
battery_types,xduoox3: ""
</source>
<dest>
*: none
battery_types: ""
xduoox3: ""
battery_types,xduoox3: ""
</dest>
<voice>
*: none
battery_types: ""
xduoox3: ""
battery_types,xduoox3: ""
</voice>
</phrase>
<phrase>
@ -3544,18 +3541,15 @@
user: core
<source>
*: none
battery_types: ""
xduoox3: ""
battery_types,xduoox3: ""
</source>
<dest>
*: none
battery_types: ""
xduoox3: ""
battery_types,xduoox3: ""
</dest>
<voice>
*: none
battery_types: ""
xduoox3: ""
battery_types,xduoox3: ""
</voice>
</phrase>
<phrase>
@ -3688,8 +3682,8 @@
user: core
<source>
*: none
gigabeat*,iaudiom5,iaudiox5,ipod*,iriverh10,iriverh10_5gb,mrobe100,sansac200*,sansaclip*,sansaconnect,sansae200*,sansafuze*: "SELECT = Set"
aigoerosq,erosqnative,gogearsa9200,samsungyh*: "PLAY = Set"
gigabeat*,iaudiom5,iaudiox5,ipod*,iriverh10,iriverh10_5gb,mrobe100,sansac200*,sansaclip*,sansaconnect,sansae200*,sansafuze*: "SELECT = Set"
iriverh100,iriverh120,iriverh300: "NAVI = Set"
mpiohd300: "ENTER = Set"
mrobe500: "HEART = Set"
@ -3698,8 +3692,8 @@
</source>
<dest>
*: none
gigabeat*,iaudiom5,iaudiox5,ipod*,iriverh10,iriverh10_5gb,mrobe100,sansac200*,sansaclip*,sansaconnect,sansae200*,sansafuze*: "SELECT = Set"
aigoerosq,erosqnative,gogearsa9200,samsungyh*: "PLAY = Set"
gigabeat*,iaudiom5,iaudiox5,ipod*,iriverh10,iriverh10_5gb,mrobe100,sansac200*,sansaclip*,sansaconnect,sansae200*,sansafuze*: "SELECT = Set"
iriverh100,iriverh120,iriverh300: "NAVI = Set"
mpiohd300: "ENTER = Set"
mrobe500: "HEART = Set"
@ -3717,8 +3711,8 @@
user: core
<source>
*: none
gigabeatfx,mrobe500: "POWER = Revert"
aigoerosq,erosqnative,gigabeats,sansafuzeplus: "BACK = Revert"
gigabeatfx,mrobe500: "POWER = Revert"
gogearsa9200: "LEFT = Revert"
iaudiom5,iaudiox5: "RECORD = Revert"
ipod*,mpiohd300,sansac200*: "MENU = Revert"
@ -3731,8 +3725,8 @@
</source>
<dest>
*: none
gigabeatfx,mrobe500: "POWER = Revert"
aigoerosq,erosqnative,gigabeats,sansafuzeplus: "BACK = Revert"
gigabeatfx,mrobe500: "POWER = Revert"
gogearsa9200: "LEFT = Revert"
iaudiom5,iaudiox5: "RECORD = Revert"
ipod*,mpiohd300,sansac200*: "MENU = Revert"
@ -6994,7 +6988,6 @@
*: "Add Current to Shortcuts"
</voice>
</phrase>
<phrase>
id: LANG_PITCH
desc: "pitch" in the pitch screen
@ -16998,15 +16991,15 @@
user: core
<source>
*: none
lineout_poweroff,erosqnative: "Line Out"
erosqnative,lineout_poweroff: "Line Out"
</source>
<dest>
*: none
lineout_poweroff,erosqnative: "Line Out"
erosqnative,lineout_poweroff: "Line Out"
</dest>
<voice>
*: none
lineout_poweroff,erosqnative: "Line Out"
erosqnative,lineout_poweroff: "Line Out"
</voice>
</phrase>
<phrase>

View file

@ -666,7 +666,8 @@ static const char * id3_get_or_speak_info(int selected_item, void* data,
case LANG_ID3_BITRATE:
if (!id3->bitrate)
return NULL;
snprintf(buffer, buffer_len, "%d kbps%s", id3->bitrate,
snprintf(buffer, buffer_len, "%d kbps%s%s", id3->bitrate,
id3->vbr ? " " : "",
id3->vbr ? str(LANG_ID3_VBR) : (const unsigned char*) "");
val=buffer;
if(say_it)

View file

@ -20,6 +20,7 @@ sub trim {
my ($string) = @_;
$string =~ s/^\s+//;
$string =~ s/\s+$//;
$string =~ tr/\t//d;
return $string;
}
@ -61,7 +62,13 @@ sub parselangfile {
}
} elsif ($pos ne 'phrase' && $line =~ /^([^:]+): ?\"?([^\"]*)\"?$/) {
my @targets = split(',', $1);
my $w = $2;
my $w;
if ($id ne 'VOICE_PAUSE') {
$w = trim($2);
} else {
$w = $2;
}
foreach (@targets) {
my $l = trim($_);

View file

@ -698,6 +698,9 @@ if (defined($v) or defined($ENV{'V'})) {
# add the tools dir to the path temporarily, for calling various tools
$ENV{'PATH'} = dirname($0) . ':' . $ENV{'PATH'};
# logging needs to be UTF8
binmode(*STDOUT, ':encoding(utf8)');
my $tts_object = init_tts($s, $S, $l);
# Do what we're told