mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Keeping languages alphabetically; checking for empty strings
This commit is contained in:
parent
1a5ca67f57
commit
3e04208de3
16
i18n.c
16
i18n.c
@ -4,7 +4,7 @@
|
|||||||
* See the main source file 'vdr.c' for copyright information and
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* how to reach the author.
|
||||||
*
|
*
|
||||||
* $Id: i18n.c 1.3 2000/11/18 13:28:19 kls Exp $
|
* $Id: i18n.c 1.4 2000/11/18 14:21:41 kls Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -13,7 +13,7 @@
|
|||||||
* 1. Announce your translation action on the Linux-DVB mailing
|
* 1. Announce your translation action on the Linux-DVB mailing
|
||||||
* list to avoid duplicate work.
|
* list to avoid duplicate work.
|
||||||
* 2. Increase the value of 'NumLanguages'.
|
* 2. Increase the value of 'NumLanguages'.
|
||||||
* 3. Add a new line to every member of the 'Phrases[]' array,
|
* 3. Insert a new line in every member of the 'Phrases[]' array,
|
||||||
* containing the translated text for the new language.
|
* containing the translated text for the new language.
|
||||||
* For example, assuming you want to add the Italian language,
|
* For example, assuming you want to add the Italian language,
|
||||||
*
|
*
|
||||||
@ -28,7 +28,10 @@
|
|||||||
* "Italiano",
|
* "Italiano",
|
||||||
* },
|
* },
|
||||||
*
|
*
|
||||||
* and so on.
|
* and so on. Insert your language so that all the entries
|
||||||
|
* following 'English' will be sorted alphabetically, and write
|
||||||
|
* the name of your language in your language (not in English,
|
||||||
|
* which means that it should be 'Italiano', not 'Italian').
|
||||||
* Note that only the characters defined in 'fontosd.c' will
|
* Note that only the characters defined in 'fontosd.c' will
|
||||||
* be available!
|
* be available!
|
||||||
* 4. Compile VDR and test the new language by switching to it
|
* 4. Compile VDR and test the new language by switching to it
|
||||||
@ -357,8 +360,11 @@ const char *tr(const char *s)
|
|||||||
{
|
{
|
||||||
if (Setup.OSDLanguage) {
|
if (Setup.OSDLanguage) {
|
||||||
for (const tPhrase *p = Phrases; **p; p++) {
|
for (const tPhrase *p = Phrases; **p; p++) {
|
||||||
if (strcmp(s, **p) == 0)
|
if (strcmp(s, **p) == 0) {
|
||||||
return (*p)[Setup.OSDLanguage];
|
const char *t = (*p)[Setup.OSDLanguage];
|
||||||
|
if (t && *t)
|
||||||
|
return t;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
esyslog(LOG_ERR, "no translation found for '%s' in language %d (%s)\n", s, Setup.OSDLanguage, Phrases[0][Setup.OSDLanguage]);
|
esyslog(LOG_ERR, "no translation found for '%s' in language %d (%s)\n", s, Setup.OSDLanguage, Phrases[0][Setup.OSDLanguage]);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user