I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 78dcfd83 authored by zzz's avatar zzz
Browse files

* Translations:

  - Use JVM language name if available
  - Correct Estonian language code from ee to et
parent 95d0dc04
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,7 @@ trans.da = apps/routerconsole/locale/messages_da.po ...@@ -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 { ...@@ -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 { ...@@ -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 { ...@@ -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 @@ ...@@ -38,7 +38,7 @@
<a href="/console?lang=cs&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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 @@ ...@@ -65,7 +65,7 @@
<a href="/home?lang=cs&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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&amp;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 { ...@@ -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.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment