1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Created help files form the current po entries.

This commit is contained in:
Werner Koch 2007-12-04 15:00:14 +00:00
parent 1d282c5938
commit 63ec0b271c
38 changed files with 7493 additions and 271 deletions

View file

@ -149,7 +149,8 @@ findkey_fname (const char *key, const char *fname)
/* Try the help files depending on the locale. */
static char *
findkey_locale (const char *key, const char *locname, const char *dirname)
findkey_locale (const char *key, const char *locname,
int only_current_locale, const char *dirname)
{
const char *s;
char *fname, *ext, *p;
@ -182,9 +183,9 @@ findkey_locale (const char *key, const char *locname, const char *dirname)
result = NULL;
}
if (!result)
if (!result && (!only_current_locale || !*locname) )
{
/* Last try: Search in file without any local info. ("help.txt") */
/* Last try: Search in file without any locale info. ("help.txt") */
strcpy (ext, "txt");
result = findkey_fname (key, fname);
}
@ -205,6 +206,8 @@ findkey_locale (const char *key, const char *locname, const char *dirname)
/usr/share/gnupg/help.txt
Here LL denotes the two digit language code of the current locale.
If ONLY_CURRENT_LOCALE is set, the fucntion won;t fallback to the
english valiant ("help.txt") unless that locale has been requested.
The help file needs to be encoded in UTF-8, lines with a '#' in the
first column are comment lines and entirely ignored. Help keys are
@ -216,7 +219,7 @@ findkey_locale (const char *key, const char *locname, const char *dirname)
*/
char *
gnupg_get_help_string (const char *key)
gnupg_get_help_string (const char *key, int only_current_locale)
{
static const char *locname;
char *result;
@ -237,7 +240,7 @@ gnupg_get_help_string (const char *key)
else if (*p == '_')
{
if (count++)
*p = 0; /* Altho cut at a underscore in the territory. */
*p = 0; /* Also cut at a underscore in the territory. */
}
locname = buffer;
}
@ -246,9 +249,11 @@ gnupg_get_help_string (const char *key)
if (!key || !*key)
return NULL;
result = findkey_locale (key, locname, gnupg_sysconfdir ());
result = findkey_locale (key, locname, only_current_locale,
gnupg_sysconfdir ());
if (!result)
result = findkey_locale (key, locname, gnupg_datadir ());
result = findkey_locale (key, locname, only_current_locale,
gnupg_datadir ());
return result;
}