summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2024-05-17 08:07:18 -0400
committerSolomon Peachy <pizza@shaftnet.org>2024-05-17 08:07:58 -0400
commit6c2f8f640f59e8a45a6c0c1cff6c17e1655907b9 (patch)
tree846e530dd7064f875cd3ff146e8cd5a11ad82027
parent1530bb4849a9dc828a18985bad0c65d21a70d7d0 (diff)
downloadrockbox-6c2f8f640f.tar.gz
rockbox-6c2f8f640f.zip
genlang: Strip _all_ leading '~' from dest/voice strings
(Instead of just the first) Change-Id: I3c730fd4e570dc5ec77d63777c8499e81f1b0491
-rwxr-xr-xtools/genlang28
1 files changed, 14 insertions, 14 deletions
diff --git a/tools/genlang b/tools/genlang
index 24b29b7d9a..45f7bc82d9 100755
--- a/tools/genlang
+++ b/tools/genlang
@@ -27,7 +27,7 @@ my $SUBHEADER_SIZE = 6;
# the ability. But, starting now, this ability is no longer provided since I
# figured it was boring and unnecessary to write support for now since we
# don't use it anymore.
-
+
if(!$ARGV[0]) {
print <<MOO
@@ -263,7 +263,7 @@ sub readenglish {
my $withindest;
my $numphrases = 0;
my $numusers = 1; # core is already in the users map
-
+
while(<ENG>) {
# get rid of DOS newlines
@@ -440,7 +440,7 @@ while(<LANG>) {
if($dest eq '""' && $phrase{'desc'} !~ /deprecated/i && $idstr !~ /^VOICE/) {
print STDERR "$input:$line:1: warning: empty dest before line in non-deprecated phrase!\n";
}
-
+
my $userstr = trim($phrase{'user'});
my $user = $users{$userstr};
if ($userstr eq "") {
@@ -471,12 +471,12 @@ while(<LANG>) {
}
# Strip out the magic "Same as english" flag
- $dest =~ s/^("?)~/$1/;
- $voice =~ s/^("?)~/$1/;
-
+ $dest =~ s/^("?)~+/$1/;
+ $voice =~ s/^("?)~+/$1/;
+
$id{$idstr} = $idnum;
$idnum[$user][$idnum]=$idstr;
-
+
$source{$idstr}=$src;
$dest{$idstr}=$dest;
$voice{$idstr}=$voice;
@@ -529,7 +529,7 @@ if($prefix) {
open(HFILE_CORE, ">$prefix/lang.h") ||
die "Error: couldn't create file $prefix/lang.h\n";
open(CFILE_CORE, ">$prefix/lang_core.c") ||
- die "Error: couldn't create file $prefix/lang_core.c\n";
+ die "Error: couldn't create file $prefix/lang_core.c\n";
# get header file name
$headername = "$prefix/lang.h";
@@ -572,7 +572,7 @@ MOO
print CFILE_CORE <<MOO
/* This file was automatically generated using genlang, the strings come
from "$input" */
-
+
#include "$headername"
unsigned char *language_strings[LANG_LAST_INDEX_IN_ARRAY];
@@ -584,9 +584,9 @@ MOO
my $i;
for $i (0 .. $idcount[$users{"core"}]-1) {
my $name=$idnum[$users{"core"}][$i]; # get the ID name
-
+
$name =~ tr/\"//d; # cut off the quotes
-
+
printf HFILE_CORE (" %s, /* %d */\n", $name, $i);
}
@@ -602,9 +602,9 @@ MOO
# Output the ID names for the enum in the header file
for $i (0x8001 .. ($voiceid[$users{"core"}]-1)) {
my $name=$idnum[$users{"core"}][$i]; # get the ID name
-
+
$name =~ tr/\"//d; # cut off the quotes
-
+
printf HFILE_CORE (" %s, /* 0x%x */\n", $name, $i);
}
@@ -621,7 +621,7 @@ MOO
for $i (0 .. $idcount[$users{"core"}]-1) {
my $name=$idnum[$users{"core"}][$i]; # get the ID
my $dest = $dest{$name}; # get the destination phrase
-
+
$dest =~ s:\"$:\\0\":; # insert a \0 before the second quote
if(!$dest) {