Commit graph

72 commits

Author SHA1 Message Date
Solomon Peachy
92b80bdba5 lang: Support languages that speak the units before a numerical value
Previously, it was hardcoded to the english convention of units-last, so
"100%" would be voiced as "one hundred percent".  This adds a new
language flag that makes the units be voiced first, ie "100%" will be
voiced as "percent one hundred".

So far only the Chinese-traditional and Chinese-simplified languages
utilize this feature (taken from an old ticket, FS#10340) but I'm sure
others would want this feature too.

Change-Id: Idf825ec9299dc0ed09921cf67aec61b1ab262fc6
2023-05-22 10:30:13 -04:00
Solomon Peachy
b53d2bc432 languages: Fix RTL language file generation
The 'rtl' flags for Arabic and Hebrew was inadvertantly deleted
in 7ff3c94e1 (over a year ago, in November 2020!) but it's actually been
broken since the introduction of 'updatelang', in 2305966d (July 2020)

The fix here is to change the 'RTL' flag from an <options> section in
the language file to a comment in the header.  It's not as pure in a
design sense but it makes for a much cleaner implementation.

I may further revamp this by making the 'RTL' flag into an explicit
LANG_xxx string

Change-Id: I48f394adfadc0aa804fd67690c87cc28f04fccdc
2021-12-15 19:19:44 -05:00
Solomon Peachy
b9d13b898d genlang: strip out the '-u' mode as it's now handled by updatelang
Change-Id: Ic05cc72282cc016048e292ee0bef41c38148af8c
2020-07-27 17:20:59 -04:00
Solomon Peachy
688c89cfe1 genlang: More voice-related fixes.
* Use consistent ID numbering
 * Use consistent logic for voicelist and voicebin files
 * Fix situations where English <-> English would fail in strange ways
 * Delete leftover tmpfile.
 * Off-by-one error in voice validation code
 * Off-by-one error in voicelist generation

Change-Id: Ib3cea2c6612138b1cbe614dacbe51000199cc9ad
2020-07-21 11:59:47 +00:00
Solomon Peachy
73a0a9f5aa genlang: Skip strings not present in english in all voicelist modes
Change-Id: If4a4c8c42ce68ecac4aee4400ea82cc709e26c1a
2020-07-13 08:05:06 -04:00
William Wilgus
c93666d08e talk.h make voice files check for proper number of entries on load
In addition to version and target also check id1_max & id2_max
for proper length before allowing voice file to be loaded

Change-Id: I36016059d07781b0bb43dd9873bbb6e565298d76
2020-04-17 07:30:23 +02:00
Solomon Peachy
55eb1c54eb FS#7704 - Talk support for plugins
Original patch by Mario Lang
Heavily updated by Igor Poretsky
Further updated by myself

  This patch breaks binary API compatibility by placing the new
  functions where they make the most logical sense. IMO this is
  the better approach to take given the scope of the changes needed
  for talk support.

  Since binary API is changing, the patch also moves some other
  functions around to more logical locations.

  As well as voice support in plugins, this patch voice-enables several
  simple plugins.  There will be follow-up patches for many plugins that
  build on this one.

Change-Id: I18070c06e77e8a3c016c2eb6b6c5dbe6633b9b54
2019-07-20 08:48:35 +02:00
Dominik Riebeling
d6ef5a0d80 Create binary voice string archive on target.
Extend genlang to create files holding the voice strings in a binary format
similar to lng. Create such files for all languages during a normal build, put
them in a zip file and add them to rockbox.zip so they are installed with a
main build.

Creating a voice file requires access to the voice strings, which are currently
not distributed with Rockbox. Therefore it is necessary to either have access
to the source code of the installed build or to use a build the genlang service
on rockbox.org can retrieve the strings for, making it impossible for normal
users to generate a voice file for custom builds, test builds and older builds
that aren't supported by the rockbox.org script. It also requires a network
connection when creating voice files with Rockbox Utility even if creating a
voice file by itself isn't network related.

Furthermore, putting the voice strings on the target is also a prerequisite for
eventually supporting a TTS on the player.

Strip voice strings path.

Change-Id: Ic2f86130909b3b257986a348e5cfcf618c4500c3
2012-06-09 22:44:56 +02:00
Dominik Riebeling
9f7c6a1745 genlang: add VOICE_ prefix to unused voice-only strings.
voicefont uses the id prefix VOICE_ to recognize voice-only strings. Unused ids
get a NOT_USED prefixed entry to keep order correct. However, since this
applies to voice-only entries as well voicefont doesn't recognize those as
voice entries and puts them at the end of the lang strings table. This messes
up the order in the created voice file, so add VOICE_ as prefix so voicefont
can identify them.

Change-Id: Ic3f2ec038ce1ed93c84286979e6583b478fa697e
2012-06-05 23:30:04 +02:00
Torne Wuff
8a0db7bf34 Fix FS#12272 - genlang changes broke some targets
New genlang code forgot to allow for the wildcard being the full target name
with a * appended.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30514 a1c6a512-1295-4272-9138-f99709370657
2011-09-12 15:19:57 +00:00
Thomas Martitz
82acdd3e1c Make genlang faster by doing better regexes.
With this change generating all languages takes only two-thirds the
time. It changes the acceptable syntax for target wildcards in language
files, however: instead of a comma-separated list of glob-style
wildcards it requires that it be a comma-separated list of prefix
matches, i.e. the * can only appear at the end of each wildcard, and ?
cannot be used. This does not require any changes to existing language
files as they are all already in this form.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30481 a1c6a512-1295-4272-9138-f99709370657
2011-09-08 14:37:50 +00:00
Jens Arnold
a7bedc5e4f Make genlang rewrite english.list if it exists but is older than english.lang
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30056 a1c6a512-1295-4272-9138-f99709370657
2011-06-23 06:42:08 +00:00
Björn Stenberg
1f77d091a5 Only create english.list for binary output.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29499 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 12:47:48 +00:00
Björn Stenberg
d0fdeca19e Added english id caching to speed up builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29498 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 12:30:49 +00:00
Marcin Bukat
d233066155 Revert r29494 as It is a) buggy b) doesn't seem to do any good in terms of speed.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29495 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 09:42:51 +00:00
Marcin Bukat
c9b0044274 genlang: Remove unused subs. Use precompiled regex in parsetarget(). Minor tweek by substituting s/\r//g with tr/\r//d.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29494 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 09:22:42 +00:00
Björn Stenberg
6170ded83d Almost 30% faster.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29488 a1c6a512-1295-4272-9138-f99709370657
2011-03-02 00:20:56 +00:00
Jeffrey Goode
9e28863669 lang.h voice comments were off by 1, fixed
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26296 a1c6a512-1295-4272-9138-f99709370657
2010-05-26 03:51:13 +00:00
Jeffrey Goode
fe0f5baa73 Fix crash in talk.c logf line when outputting voice only clips, more comments in lang.h
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26294 a1c6a512-1295-4272-9138-f99709370657
2010-05-26 03:11:00 +00:00
Peter D'Hoye
3e73fecf68 Fix genlang tool broken by r22945
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23540 a1c6a512-1295-4272-9138-f99709370657
2009-11-05 22:18:29 +00:00
Tom Ross
ec2737b2c2 Change the .lng files to contain strings from multiple users. Still hard-coded to only output the core strings for now. Should be the majority of the core changes needed for translatable plugins.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23241 a1c6a512-1295-4272-9138-f99709370657
2009-10-18 00:56:42 +00:00
Tom Ross
6d4d44caf6 Add support to genlang to sort strings based on their user. This is useful for translatable plugins. Currently, the .lng that is generated is hard-coded to only contain strings marked as core. The output of this version of genlang should be the same as non-sorting, so we don't need to change the version number.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23218 a1c6a512-1295-4272-9138-f99709370657
2009-10-17 05:24:11 +00:00
Tomer Shalev
6d80565b1b RTL support in menus
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22945 a1c6a512-1295-4272-9138-f99709370657
2009-10-05 11:43:38 +00:00
Tomer Shalev
ce53dd6523 Revert usage string change from r22930.
Amiconn: "langv2" had nothing to do with the language version byte in the
generated .lng file, so "langv4" makes no sense. It refers to the format of the
.lang. The current, tag-based format which allows to restrict strings to
certain targets or features is called langv2 versus the old, simpler format.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22939 a1c6a512-1295-4272-9138-f99709370657
2009-10-05 06:11:00 +00:00
Tomer Shalev
2a91a9a19e Use similiar constants in genlang and language.c.
- In the future, they should be united.
- Fix bug in max size calculation


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22930 a1c6a512-1295-4272-9138-f99709370657
2009-10-04 22:25:52 +00:00
Tom Ross
104fb378ec More GSoC related work. Have genlang parse the user field of the lang files. For now, all user strings are core. In the future more users will be added. Add missing user fields to a few phrases in some languages. Genlang will also warn if a phrase is missing the user field or it is unknown. The output format is unchanged.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20187 a1c6a512-1295-4272-9138-f99709370657
2009-03-03 01:38:26 +00:00
Tom Ross
4fb5864a6c Move generated lang-related files to their own directory in preparation of localizable plugins.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20170 a1c6a512-1295-4272-9138-f99709370657
2009-03-02 06:13:18 +00:00
Jonas Häggqvist
6d638922e1 Make genlang output errors on STDERR. FS#9668 by Tomer Shalev.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20130 a1c6a512-1295-4272-9138-f99709370657
2009-02-27 20:00:45 +00:00
Maurus Cuelenaere
e8da447729 Commit FS#9494 by Yoshihisa Uchida: add support for building the simulators under Windows using MingW
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19923 a1c6a512-1295-4272-9138-f99709370657
2009-02-04 20:59:27 +00:00
Jonas Häggqvist
098a7d0c75 Make genlang emit a warning if a translation file has an dest string for a phrase that isn't deprecated, since this will result in empty strings when using that translation. This will mess up the build table, but the plan is to either quickly update the translation, or simply delete the phrase and let the translator provide a full translation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19039 a1c6a512-1295-4272-9138-f99709370657
2008-11-08 22:04:28 +00:00
Magnus Holmgren
afd2f681d1 Fix the target pattern matching in genlang. Not sure if it is the 'right' fix, but it unbreaks the e200 build for me.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18903 a1c6a512-1295-4272-9138-f99709370657
2008-10-28 19:40:53 +00:00
Dave Chapman
509c06aa03 Add a -s option to genlang to sort a language file into the same order as english.lang
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18303 a1c6a512-1295-4272-9138-f99709370657
2008-08-17 12:25:39 +00:00
Jonas Häggqvist
7c535108bf Only print the header if we're running update.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18253 a1c6a512-1295-4272-9138-f99709370657
2008-08-12 14:52:56 +00:00
Jonas Häggqvist
da5f16a606 Fix genlang to not remove the header from translation files.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18248 a1c6a512-1295-4272-9138-f99709370657
2008-08-11 21:36:00 +00:00
Daniel Stenberg
265c1c4632 make the warnings gcc-style to be trapped by the scripts easier
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16341 a1c6a512-1295-4272-9138-f99709370657
2008-02-17 23:42:38 +00:00
Jonas Häggqvist
bd8d7a5f5e Make genlang shut up about the non-error of not putting quotes around "none" in the voice. Also make it print slightly nicer errors/warnings.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16340 a1c6a512-1295-4272-9138-f99709370657
2008-02-17 23:34:52 +00:00
Jonas Häggqvist
2c4438ac51 Make genlang ignore leading and trailing whitespace in source and desc lines (not the strings). If this behavior is unwanted, feel free to revert.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14567 a1c6a512-1295-4272-9138-f99709370657
2007-09-01 20:54:17 +00:00
Daniel Stenberg
59975ccf3c fix the -o output for indexes where there's no voice given, this is for
FS#7576, and it typically caused a bazillion of LANG_SET_BOOL_YES to get output
when -o was used with non-english


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14277 a1c6a512-1295-4272-9138-f99709370657
2007-08-10 23:08:29 +00:00
Daniel Stenberg
d71339bf44 Fix for FS#7574. It previously failed to properly deal with multiple dest
strings. I also added the numerical id number for strings in the generated
header file, which is useful when the new lngdump tool is used and you want to
compare the ids for the built-in strings to the ones in the generated binary
files.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14274 a1c6a512-1295-4272-9138-f99709370657
2007-08-10 22:08:44 +00:00
Nils Wallménius
b311367481 *** Lang v2 cleanup (FS#6574) ***
1) Introduces apps/features.txt that controls which strings are included 
for each target based on defines.
2) .lng and .voice files are now target specific and the format versions 
of both these file types have been bumped, which means that new voice 
files are needed. 
3) Use the 'features' mechanism to exclude strings for targets that 
didn't use them.
4) Delete unused and deprecated and duplicated strings, sort strings in 
english.lang

Some string IDs were changed so translations will be slightly worse than 
before.



git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14198 a1c6a512-1295-4272-9138-f99709370657
2007-08-05 19:19:39 +00:00
Daniel Stenberg
d0bc092e9e skip comments when trying to parse and compare phrases!
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14169 a1c6a512-1295-4272-9138-f99709370657
2007-08-03 20:29:32 +00:00
Daniel Stenberg
a12c591ac3 when generating binary output, we now let the master language file properly
dictate when a certain phrase doesn't exist and should be ignored in the
output


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14150 a1c6a512-1295-4272-9138-f99709370657
2007-08-02 22:09:00 +00:00
Nils Wallménius
90ccc336b4 Make genlang output correct .lng files when the 'none' keyword is used but is not all lowercase
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13971 a1c6a512-1295-4272-9138-f99709370657
2007-07-24 18:49:33 +00:00
Daniel Stenberg
fcd3a49b50 attempt to fix -u
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13721 a1c6a512-1295-4272-9138-f99709370657
2007-06-26 08:44:59 +00:00
Daniel Stenberg
f22e6a5964 FS#6652 fix attempt. Make the phrase id counting take the dest pattern into
account so that the binary and source code output gets the same numbering.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13443 a1c6a512-1295-4272-9138-f99709370657
2007-05-20 13:20:45 +00:00
Daniel Stenberg
5b5162547c match target names more explicitly so that h10 won't match h100 etc
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12769 a1c6a512-1295-4272-9138-f99709370657
2007-03-14 23:02:36 +00:00
Daniel Stenberg
dd0e6e75a0 prevent the incorrect warnings displayed when -u was used, added additional
info to the warning output and moved a comment to the accurate place


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11371 a1c6a512-1295-4272-9138-f99709370657
2006-10-28 17:05:42 +00:00
Daniel Stenberg
537c90b286 Make -t support a range of "targets", which reallly should be one target
and a range of named features.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11254 a1c6a512-1295-4272-9138-f99709370657
2006-10-18 07:41:00 +00:00
Daniel Stenberg
a181a4c1eb Fixed a bug where it didn't warn on lack of quotes as it was supposed to.
Now this treats a string given without quotes as "" (but still warns about it).


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9824 a1c6a512-1295-4272-9138-f99709370657
2006-04-27 22:49:36 +00:00
Miika Pekkarinen
991665bcdf More usable playlist generation, added "<All tracks>" entry to tag
browser.


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@9729 a1c6a512-1295-4272-9138-f99709370657
2006-04-19 11:03:37 +00:00