Changeset 4f8d84e


Ignore:
Timestamp:
Oct 14, 2008 4:23:23 PM (12 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
078256d
Parents:
ae967d6
Message:

Add multilanguage support for index.jsp

Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • apps/routerconsole/java/src/net/i2p/router/web/ContentHelper.java

    rae967d6 r4f8d84e  
    11package net.i2p.router.web;
     2
     3import java.io.File;
     4import java.util.Locale;
    25
    36import net.i2p.router.RouterContext;
     
    811    private int _maxLines;
    912    private boolean _startAtBeginning;
     13    private String _lang;
    1014    private RouterContext _context;
    1115    /**
     
    2933        _startAtBeginning = Boolean.valueOf(""+moo).booleanValue();
    3034    }
     35    public void setLang(String l) { _lang = l; }
    3136   
    3237    public void setMaxLines(String lines) {
     
    4247    }
    4348    public String getContent() {
    44         String str = FileUtil.readTextFile(_page, _maxLines, _startAtBeginning);
     49        String str = FileUtil.readTextFile(filename(), _maxLines, _startAtBeginning);
    4550        if (str == null)
    4651            return "";
     
    4954    }
    5055    public String getTextContent() {
    51         String str = FileUtil.readTextFile(_page, _maxLines, _startAtBeginning);
     56        String str = FileUtil.readTextFile(filename(), _maxLines, _startAtBeginning);
    5257        if (str == null)
    5358            return "";
     
    6772        }
    6873    }
     74
     75    /**
     76     * Convert file.ext to file_lang.ext if it exists.
     77     * Get lang from either the cgi lang param or from the default locale.
     78     */
     79    private String filename() {
     80        int lastdot = _page.lastIndexOf('.');
     81        if (lastdot <= 0)
     82            return _page;
     83        String lang = _lang;
     84        if (lang == null || lang.length() <= 0) {
     85            lang = Locale.getDefault().getLanguage();
     86            if (lang == null || lang.length() <= 0)
     87                return _page;
     88        }
     89        if (lang.equals("en"))
     90            return _page;
     91        String newname = _page.substring(0, lastdot) + '_' + lang + _page.substring(lastdot);
     92        File newfile = new File(newname);
     93        if (newfile.exists())
     94            return newname;
     95        return _page;
     96    }
    6997}
  • apps/routerconsole/jsp/index.jsp

    rae967d6 r4f8d84e  
    3232 <jsp:setProperty name="contenthelper" property="page" value="docs/readme.html" />
    3333 <jsp:setProperty name="contenthelper" property="maxLines" value="300" />
     34 <jsp:setProperty name="contenthelper" property="lang" value="<%=request.getParameter("lang")%>" />
    3435 <jsp:getProperty name="contenthelper" property="content" />
    3536</div>
  • build.xml

    rae967d6 r4f8d84e  
    269269        <mkdir dir="pkg-temp/docs" />
    270270        <copy file="readme.html" todir="pkg-temp/docs/" />
     271        <copy file="readme_de.html" todir="pkg-temp/docs/" />
    271272        <!-- polecat: please put your modified toolbar.html in installer/resources/toolbar.html
    272273             and uncomment the following -->
     
    346347        <copy file="build/routerconsole.war" todir="pkg-temp/webapps/" />
    347348        <copy file="build/addressbook.war" todir="pkg-temp/webapps/" />
     349        <!-- New readme_de.html file - For one release only, remove after 0.6.5 is out -->
     350        <mkdir dir="pkg-temp/docs" />
     351        <copy file="readme_de.html" todir="pkg-temp/docs/" />
    348352    </target>
    349353    <target name="prepupdateRouter" depends="buildrouter">
  • history.txt

    rae967d6 r4f8d84e  
     12008-10-14 zzz
     2    * index.jsp: Add multilanguage support for readme.html;
     3      add readme_de.html (thanks devzero!)
     4    * configupdate.jsp, configadvanced.jsp:
     5      Disable word wrap in textareas
     6    * install*.txt: Update for 1.5
     7    * summary.jsp: Remove failing peer count
     8
    192008-10-10 zzz
    210    * Profiles: Reduce reject penalty in
  • readme.html

    rae967d6 r4f8d84e  
     1<p align=right><font size="-1">English | <a href="/index.jsp?lang=de">Deutsch</a></font></p>
    12<p>If you've just started I2P, the Active: numbers on the left should start to
    23grow over the next few minutes and you'll see a "shared clients" local destination listed
  • router/java/src/net/i2p/router/RouterVersion.java

    rae967d6 r4f8d84e  
    1818    public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $";
    1919    public final static String VERSION = "0.6.4";
    20     public final static long BUILD = 4;
     20    public final static long BUILD = 5;
    2121    public static void main(String args[]) {
    2222        System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
Note: See TracChangeset for help on using the changeset viewer.