forked from I2P_Developers/i2p.i2p
* Translations:
- Use JVM language name if available - Correct Estonian language code from ee to et
This commit is contained in:
@ -26,7 +26,7 @@ trans.da = apps/routerconsole/locale/messages_da.po
|
|||||||
trans.de = apps/routerconsole/locale/messages_de.po
|
trans.de = apps/routerconsole/locale/messages_de.po
|
||||||
trans.el = apps/routerconsole/locale/messages_el.po
|
trans.el = apps/routerconsole/locale/messages_el.po
|
||||||
trans.es = apps/routerconsole/locale/messages_es.po
|
trans.es = apps/routerconsole/locale/messages_es.po
|
||||||
trans.et_EE = apps/routerconsole/locale/messages_ee.po
|
trans.et_EE = apps/routerconsole/locale/messages_et.po
|
||||||
trans.fi = apps/routerconsole/locale/messages_fi.po
|
trans.fi = apps/routerconsole/locale/messages_fi.po
|
||||||
trans.fr = apps/routerconsole/locale/messages_fr.po
|
trans.fr = apps/routerconsole/locale/messages_fr.po
|
||||||
trans.hu = apps/routerconsole/locale/messages_hu.po
|
trans.hu = apps/routerconsole/locale/messages_hu.po
|
||||||
|
@ -73,7 +73,7 @@ public class ConfigUIHelper extends HelperBase {
|
|||||||
* Any language-specific flag added to the icon set must be
|
* Any language-specific flag added to the icon set must be
|
||||||
* added to the top-level build.xml for the updater.
|
* added to the top-level build.xml for the updater.
|
||||||
*/
|
*/
|
||||||
private static final String langs[] = {"ar", "cs", "da", "de", "ee", "el", "en", "es", "fi",
|
private static final String langs[] = {"ar", "cs", "da", "de", "et", "el", "en", "es", "fi",
|
||||||
"fr", "hu", "it", "nl", "pl", "pt", "ru",
|
"fr", "hu", "it", "nl", "pl", "pt", "ru",
|
||||||
"sv", "uk", "vi", "zh"};
|
"sv", "uk", "vi", "zh"};
|
||||||
private static final String flags[] = {"lang_ar", "cz", "dk", "de", "ee", "gr", "us", "es", "fi",
|
private static final String flags[] = {"lang_ar", "cz", "dk", "de", "ee", "gr", "us", "es", "fi",
|
||||||
@ -96,7 +96,7 @@ public class ConfigUIHelper extends HelperBase {
|
|||||||
buf.append("checked=\"checked\" ");
|
buf.append("checked=\"checked\" ");
|
||||||
buf.append("value=\"").append(langs[i]).append("\">")
|
buf.append("value=\"").append(langs[i]).append("\">")
|
||||||
.append("<img height=\"11\" width=\"16\" alt=\"\" src=\"/flags.jsp?c=").append(flags[i]).append("\"> ")
|
.append("<img height=\"11\" width=\"16\" alt=\"\" src=\"/flags.jsp?c=").append(flags[i]).append("\"> ")
|
||||||
.append(_(xlangs[i])).append("<br>\n");
|
.append(Messages.getDisplayLanguage(langs[i], xlangs[i], _context)).append("<br>\n");
|
||||||
}
|
}
|
||||||
return buf.toString();
|
return buf.toString();
|
||||||
}
|
}
|
||||||
|
@ -39,4 +39,17 @@ public class Messages extends Translate {
|
|||||||
public static String getString(int n, String s, String p, I2PAppContext ctx) {
|
public static String getString(int n, String s, String p, I2PAppContext ctx) {
|
||||||
return Translate.getString(n, s, p, ctx, BUNDLE_NAME);
|
return Translate.getString(n, s, p, ctx, BUNDLE_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the "display language", e.g. "English" for the language specified
|
||||||
|
* by langCode, using the current language.
|
||||||
|
* Uses translation if available, then JVM Locale.getDisplayLanguage() if available, else default param.
|
||||||
|
*
|
||||||
|
* @param langCode two-letter lower-case
|
||||||
|
* @param dflt e.g. "English"
|
||||||
|
* @since 0.9.5
|
||||||
|
*/
|
||||||
|
public static String getDisplayLanguage(String langCode, String dflt, I2PAppContext ctx) {
|
||||||
|
return Translate.getDisplayLanguage(langCode, dflt, ctx, BUNDLE_NAME);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
<a href="/console?lang=cs&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=cz" title="čeština" alt="čeština"></a>
|
<a href="/console?lang=cs&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=cz" title="čeština" alt="čeština"></a>
|
||||||
<a href="/console?lang=da&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=dk" title="Dansk" alt="Dansk"></a>
|
<a href="/console?lang=da&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=dk" title="Dansk" alt="Dansk"></a>
|
||||||
<a href="/console?lang=de&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=de" title="Deutsch" alt="Deutsch"></a>
|
<a href="/console?lang=de&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=de" title="Deutsch" alt="Deutsch"></a>
|
||||||
<a href="/console?lang=ee&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=ee" title="Eesti" alt="Eesti"></a>
|
<a href="/console?lang=et&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=ee" title="Eesti" alt="Eesti"></a>
|
||||||
<a href="/console?lang=es&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=es" title="Español" alt="Español"></a>
|
<a href="/console?lang=es&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=es" title="Español" alt="Español"></a>
|
||||||
<a href="/console?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a>
|
<a href="/console?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a>
|
||||||
<a href="/console?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a><br>
|
<a href="/console?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a><br>
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
<a href="/home?lang=cs&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=cz" title="Česky" alt="Česky"></a>
|
<a href="/home?lang=cs&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=cz" title="Česky" alt="Česky"></a>
|
||||||
<a href="/home?lang=da&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=dk" title="Dansk" alt="Dansk"></a>
|
<a href="/home?lang=da&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=dk" title="Dansk" alt="Dansk"></a>
|
||||||
<a href="/home?lang=de&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=de" title="Deutsch" alt="Deutsch"></a>
|
<a href="/home?lang=de&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=de" title="Deutsch" alt="Deutsch"></a>
|
||||||
<a href="/home?lang=ee&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=ee" title="Eesti" alt="Eesti"></a>
|
<a href="/home?lang=et&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=ee" title="Eesti" alt="Eesti"></a>
|
||||||
<a href="/home?lang=es&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=es" title="Español" alt="Español"></a>
|
<a href="/home?lang=es&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=es" title="Español" alt="Español"></a>
|
||||||
<a href="/home?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a>
|
<a href="/home?lang=fi&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fi" title="Suomi" alt="Suomi"></a>
|
||||||
<a href="/home?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a><br>
|
<a href="/home?lang=fr&consoleNonce=<%=consoleNonce%>"><img height="11" width="16" style="padding: 0 2px;" src="/flags.jsp?c=fr" title="Français" alt="Français"></a><br>
|
||||||
|
@ -163,6 +163,29 @@ public abstract class Translate {
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return the "display language", e.g. "English" for the language specified
|
||||||
|
* by langCode, using the current language.
|
||||||
|
* Uses translation if available, then JVM Locale.getDisplayLanguage() if available, else default param.
|
||||||
|
*
|
||||||
|
* @param langCode two-letter lower-case
|
||||||
|
* @param dflt e.g. "English"
|
||||||
|
* @since 0.9.5
|
||||||
|
*/
|
||||||
|
public static String getDisplayLanguage(String langCode, String dflt, I2PAppContext ctx, String bun) {
|
||||||
|
String curLang = getLanguage(ctx);
|
||||||
|
if (!"en".equals(curLang)) {
|
||||||
|
String rv = getString(dflt, ctx, bun);
|
||||||
|
if (!rv.equals(dflt))
|
||||||
|
return rv;
|
||||||
|
Locale curLocale = new Locale(curLang);
|
||||||
|
rv = (new Locale(langCode)).getDisplayLanguage(curLocale);
|
||||||
|
if (rv.length() > 0 && !rv.equals(langCode))
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
return dflt;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clear the cache.
|
* Clear the cache.
|
||||||
* Call this after adding new bundles to the classpath.
|
* Call this after adding new bundles to the classpath.
|
||||||
|
Reference in New Issue
Block a user