Changeset 78dcfd8


Ignore:
Timestamp:
Jan 29, 2013 1:44:36 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
573692d
Parents:
95d0dc0
Message:
  • Translations:
    • Use JVM language name if available
    • Correct Estonian language code from ee to et
Files:
6 edited
1 moved

Legend:

Unmodified
Added
Removed
  • .tx/config

    r95d0dc0 r78dcfd8  
    2727trans.el = apps/routerconsole/locale/messages_el.po
    2828trans.es = apps/routerconsole/locale/messages_es.po
    29 trans.et_EE = apps/routerconsole/locale/messages_ee.po
     29trans.et_EE = apps/routerconsole/locale/messages_et.po
    3030trans.fi = apps/routerconsole/locale/messages_fi.po
    3131trans.fr = apps/routerconsole/locale/messages_fr.po
  • apps/routerconsole/java/src/net/i2p/router/web/ConfigUIHelper.java

    r95d0dc0 r78dcfd8  
    7474     *  added to the top-level build.xml for the updater.
    7575     */
    76     private static final String langs[] = {"ar", "cs", "da", "de", "ee", "el", "en", "es", "fi",
     76    private static final String langs[] = {"ar", "cs", "da", "de", "et", "el", "en", "es", "fi",
    7777                                           "fr", "hu", "it", "nl", "pl", "pt", "ru",
    7878                                           "sv", "uk", "vi", "zh"};
     
    9797            buf.append("value=\"").append(langs[i]).append("\">")
    9898               .append("<img height=\"11\" width=\"16\" alt=\"\" src=\"/flags.jsp?c=").append(flags[i]).append("\"> ")
    99                .append(_(xlangs[i])).append("<br>\n");
     99               .append(Messages.getDisplayLanguage(langs[i], xlangs[i], _context)).append("<br>\n");
    100100        }
    101101        return buf.toString();
  • apps/routerconsole/java/src/net/i2p/router/web/Messages.java

    r95d0dc0 r78dcfd8  
    4040        return Translate.getString(n, s, p, ctx, BUNDLE_NAME);
    4141    }
     42
     43    /**
     44     *  Return the "display language", e.g. "English" for the language specified
     45     *  by langCode, using the current language.
     46     *  Uses translation if available, then JVM Locale.getDisplayLanguage() if available, else default param.
     47     *
     48     *  @param langCode two-letter lower-case
     49     *  @param dflt e.g. "English"
     50     *  @since 0.9.5
     51     */
     52    public static String getDisplayLanguage(String langCode, String dflt, I2PAppContext ctx) {
     53        return Translate.getDisplayLanguage(langCode, dflt, ctx, BUNDLE_NAME);
     54    }
    4255}
  • apps/routerconsole/jsp/console.jsp

    r95d0dc0 r78dcfd8  
    3939    <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>
    4040    <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>
    41     <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>
     41    <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>
    4242    <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>
    4343    <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>
  • apps/routerconsole/jsp/home.jsp

    r95d0dc0 r78dcfd8  
    6666    <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>
    6767    <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>
    68     <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>
     68    <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>
    6969    <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>
    7070    <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>
  • core/java/src/net/i2p/util/Translate.java

    r95d0dc0 r78dcfd8  
    165165
    166166    /**
     167     *  Return the "display language", e.g. "English" for the language specified
     168     *  by langCode, using the current language.
     169     *  Uses translation if available, then JVM Locale.getDisplayLanguage() if available, else default param.
     170     *
     171     *  @param langCode two-letter lower-case
     172     *  @param dflt e.g. "English"
     173     *  @since 0.9.5
     174     */
     175    public static String getDisplayLanguage(String langCode, String dflt, I2PAppContext ctx, String bun) {
     176        String curLang = getLanguage(ctx);
     177        if (!"en".equals(curLang)) {
     178            String rv = getString(dflt, ctx, bun);
     179            if (!rv.equals(dflt))
     180                return rv;
     181            Locale curLocale = new Locale(curLang);
     182            rv = (new Locale(langCode)).getDisplayLanguage(curLocale);
     183            if (rv.length() > 0 && !rv.equals(langCode))
     184                return rv;
     185        }
     186        return dflt;
     187    }
     188
     189    /**
    167190     *  Clear the cache.
    168191     *  Call this after adding new bundles to the classpath.
Note: See TracChangeset for help on using the changeset viewer.