Changeset c1210b1


Ignore:
Timestamp:
Jul 13, 2013 11:38:11 PM (7 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d31ce49
Parents:
71038c3
Message:
  • Translations:
    • Tag initialNews.xml for TranslateReader?
    • Drop static translated initialNews pages
    • Add new routerconsole bundle for the news alone, shipped in the jar
    • Use TranslateReader? in HTTP proxy for initial news
    • Initial translations created manually from translated xml filesx
    • Add translated proxy error pages and initial news to deletelist.txt TODO ar translation fails checkpo.sh
Files:
10 added
8 deleted
7 edited

Legend:

Unmodified
Added
Removed
  • .tx/config

    r71038c3 rc1210b1  
    6464trans.vi = apps/routerconsole/locale/messages_vi.po
    6565trans.zh_CN = apps/routerconsole/locale/messages_zh.po
     66
     67[I2P.news]
     68source_file = apps/routerconsole/locale-news/messages_en.po
     69source_lang = en
     70trans.ar = apps/routerconsole/locale-news/messages_ar.po
     71trans.de = apps/routerconsole/locale-news/messages_de.po
     72trans.es = apps/routerconsole/locale-news/messages_es.po
     73trans.fr = apps/routerconsole/locale-news/messages_fr.po
     74trans.nl = apps/routerconsole/locale-news/messages_nl.po
     75trans.pt = apps/routerconsole/locale-news/messages_pt.po
     76trans.ru_RU = apps/routerconsole/locale-news/messages_ru.po
     77trans.sv_SE = apps/routerconsole/locale-news/messages_sv.po
    6678
    6779[I2P.i2psnark]
  • apps/routerconsole/java/build.xml

    r71038c3 rc1210b1  
    9898    </target>
    9999
    100     <target name="jar1" depends="compile, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
     100    <target name="jar1" depends="compile, bundle-news, jarUpToDate, listChangedFiles" unless="jar.uptodate" >
    101101        <!-- set if unset -->
    102102        <property name="workspace.changes.j.tr" value="" />
     
    135135    </target>
    136136
    137 
    138137    <target name="jarUpToDate">
    139138        <uptodate property="jar.uptodate" targetfile="build/routerconsole.jar" >
     
    163162        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
    164163            <arg value="./bundle-messages.sh" />
     164            <arg value="-p" />
     165        </exec>
     166    </target>
     167
     168    <target name="bundle-news" unless="no.bundle">
     169        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="${require.gettext}" >
     170            <arg value="./bundle-messages-news.sh" />
     171        </exec>
     172        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="${require.gettext}" >
     173            <arg value="./bundle-messages-news.sh" />
     174        </exec>
     175        <exec executable="sh" osfamily="windows" failifexecutionfails="false" >
     176            <arg value="./bundle-messages-news.sh" />
     177        </exec>
     178    </target>
     179
     180    <target name="extractProxyTags">
     181        <java classname="net.i2p.util.TranslateReader" fork="true" failonerror="true">
     182            <classpath>
     183                <pathelement location="../../../build/i2p.jar" />
     184            </classpath>
     185            <arg value="tag" />
     186            <arg value="../../../installer/resources/initialNews/initialNews.xml" />
     187            <arg value="build/News.java" />
     188        </java>
     189    </target>
     190
     191    <target name="poupdate-news" depends="extractProxyTags">
     192        <exec executable="sh" osfamily="unix" failifexecutionfails="true" failonerror="true" >
     193            <arg value="./bundle-messages-news.sh" />
     194            <arg value="-p" />
     195        </exec>
     196        <exec executable="sh" osfamily="mac" failifexecutionfails="true" failonerror="true" >
     197            <arg value="./bundle-messages-news.sh" />
     198            <arg value="-p" />
     199        </exec>
     200        <exec executable="sh" osfamily="windows" failifexecutionfails="true" failonerror="true" >
     201            <arg value="./bundle-messages-news.sh" />
    165202            <arg value="-p" />
    166203        </exec>
  • apps/routerconsole/java/src/net/i2p/router/web/NewsHelper.java

    r71038c3 rc1210b1  
    22
    33import java.io.File;
     4import java.io.FileInputStream;
     5import java.io.IOException;
     6import java.io.Reader;
    47import java.text.SimpleDateFormat;
    58import java.util.Date;
     
    912import net.i2p.router.update.ConsoleUpdateManager;
    1013import static net.i2p.update.UpdateType.*;
     14import net.i2p.util.TranslateReader;
    1115
    1216/**
     
    139143    }
    140144
     145    private static final String BUNDLE_NAME = "net.i2p.router.news.messages";
     146
     147    /**
     148     *  If we haven't downloaded news yet, use the translated initial news file
     149     */
    141150    @Override
    142151    public String getContent() {
    143152        File news = new File(_page);
    144         if (!news.exists())
     153        if (!news.exists()) {
    145154            _page = (new File(_context.getBaseDir(), "docs/initialNews/initialNews.xml")).getAbsolutePath();
     155            // don't use super, translate on-the-fly
     156            Reader reader = null;
     157            try {
     158                char[] buf = new char[512];
     159                StringBuilder out = new StringBuilder(2048);
     160                reader = new TranslateReader(_context, BUNDLE_NAME, new FileInputStream(_page));
     161                int len;
     162                while((len = reader.read(buf)) > 0) {
     163                    out.append(buf, 0, len);
     164                }
     165                return out.toString();
     166            } catch (IOException ioe) {
     167                return "";
     168            } finally {
     169                try {
     170                    if (reader != null)
     171                        reader.close();
     172                } catch (IOException foo) {}
     173            }
     174        }
    146175        return super.getContent();
    147176    }
  • build.xml

    r71038c3 rc1210b1  
    433433        <echo message="Setting environment variable LG2 to a lang code (eg: de,zh,nl etc)" />
    434434        <echo message=" will restrict language update to the language you specified, leaving other language untact." />
    435         <ant dir="apps/routerconsole/java/" target="poupdate" />
     435        <ant dir="apps/routerconsole/java/" >
     436            <target name="poupdate" />
     437            <target name="poupdate-news" />
     438        </ant>
    436439        <ant dir="apps/i2psnark/java/" target="poupdate" />
    437440        <ant dir="apps/i2ptunnel/java/" >
  • installer/resources/deletelist.txt

    r71038c3 rc1210b1  
    44certificates/75.145.125.59.crt
    55certificates/forum.i2p2.de.crt
     6# old translated proxy error pages
     7docs/ahelper-conflict-header_ar.ht
     8docs/ahelper-conflict-header_de.ht
     9docs/ahelper-conflict-header_fr.ht
     10docs/ahelper-conflict-header_nl.ht
     11docs/ahelper-conflict-header_ru.ht
     12docs/ahelper-conflict-header_zh.ht
     13docs/auth-header_de.ht
     14docs/auth-header_fr.ht
     15docs/denied-header_ar.ht
     16docs/denied-header_de.ht
     17docs/denied-header_fr.ht
     18docs/denied-header_nl.ht
     19docs/denied-header_ru.ht
     20docs/denied-header_zh.ht
     21docs/dnf-header_de.ht
     22docs/dnf-header_fr.ht
     23docs/dnf-header_nl.ht
     24docs/dnf-header_ru.ht
     25docs/dnf-header_zh.ht
     26docs/dnfb-header_ar.ht
     27docs/dnfb-header_de.ht
     28docs/dnfb-header_fr.ht
     29docs/dnfb-header_nl.ht
     30docs/dnfb-header_ru.ht
     31docs/dnfb-header_zh.ht
     32docs/dnfh-header_de.ht
     33docs/dnfh-header_fr.ht
     34docs/dnfh-header_nl.ht
     35docs/dnfh-header_ru.ht
     36docs/dnfh-header_zh.ht
     37docs/dnfp-header_ar.ht
     38docs/dnfp-header_de.ht
     39docs/dnfp-header_fr.ht
     40docs/dnfp-header_nl.ht
     41docs/dnfp-header_ru.ht
     42docs/dnfp-header_zh.ht
     43docs/localhost-header_ar.ht
     44docs/localhost-header_de.ht
     45docs/localhost-header_fr.ht
     46docs/localhost-header_nl.ht
     47docs/localhost-header_ru.ht
     48docs/localhost-header_zh.ht
     49docs/noproxy-header_ar.ht
     50docs/noproxy-header_de.ht
     51docs/noproxy-header_fr.ht
     52docs/noproxy-header_nl.ht
     53docs/noproxy-header_ru.ht
     54docs/noproxy-header_zh.ht
     55docs/protocol-header_ar.ht
     56docs/protocol-header_de.ht
     57docs/protocol-header_fr.ht
     58docs/protocol-header_nl.ht
     59docs/protocol-header_ru.ht
     60docs/protocol-header_zh.ht
     61# old translated initial news
     62docs/initialNews/initialNews_ar.xml
     63docs/initialNews/initialNews_de.xml
     64docs/initialNews/initialNews_es.xml
     65docs/initialNews/initialNews_fr.xml
     66docs/initialNews/initialNews_nl.xml
     67docs/initialNews/initialNews_pt.xml
     68docs/initialNews/initialNews_ru.xml
     69docs/initialNews/initialNews_sv.xml
  • installer/resources/initialNews/initialNews.xml

    r71038c3 rc1210b1  
    1 <div lang="en">
    2 <h3>Congratulations on getting I2P installed!</h3>
     1<div>
     2<h3>_("Congratulations on getting I2P installed!")</h3>
    33<p>
    4 <b>Welcome to I2P!</b>
    5 Please <b>have patience</b> as I2P boots up and finds peers.
     4<b>_("Welcome to I2P!")</b>
     5_("Please {0}have patience{1} as I2P boots up and finds peers.", "<b>", "</b>")
    66</p>
    77<p>
    8 While you are waiting, please <b>adjust your bandwidth settings</b> on the
    9 <a href="config.jsp">configuration page</a>.
     8_("While you are waiting, please {0}adjust your bandwidth settings{1} on the {2}configuration page{3}.", "<b>", "</b>", "<a href=\"config.jsp\">", "</a>")
    109</p>
    1110<p>
    12 Also you can setup your browser to use the I2P proxy to reach eepsites. Just enter 127.0.0.1 (or localhost)
    13 port 4444 as a http proxy into your browser settings. Do not use SOCKS for this. More information
    14 can be found on <a href="https://www.i2p2.de/htproxyports.html">I2P browser proxy setup page</a>.
     11_("Also you can setup your browser to use the I2P proxy to reach eepsites.")
     12_("Just enter 127.0.0.1 (or localhost) port 4444 as a http proxy into your browser settings.")
     13_("Do not use SOCKS for this.")
     14_("More information can be found on the {0}I2P browser proxy setup page{1}.", "<a href=\"https://www.i2p2.de/htproxyports.html\">", "</a>")
    1515</p>
    1616<p>
    17 Once you have a "shared clients" destination listed on the left,
    18 please <b>check out</b> our
    19 <a href="http://www.i2p2.i2p/faq.html">FAQ</a>.
     17_("Once you have a \"shared clients\" destination listed on the left, please {0}check out{1} our {2}FAQ{3}.", "<b>", "</b>", "<a href=\"http://www.i2p2.i2p/faq.html\">", "</a>")
    2018</p>
    2119<p>
    22 Point your IRC client to <b>localhost:6668</b> and say hi to us on
    23 <a href="irc://127.0.0.1:6668/i2p-help">#i2p-help</a> or <a href="irc://127.0.0.1:6668/i2p">#i2p</a>.
     20_("Point your IRC client to {0}localhost:6668{1} and say hi to us on {2}#i2p-help{3} or {4}#i2p{5}.", "<b>", "</b>", "<a href=\"irc://127.0.0.1:6668/i2p-help\">", "</a>", "<a href=\"irc://127.0.0.1:6668/i2p\">", "</a>")
    2421</p>
    2522</div>
  • tests/scripts/checkpo.sh

    r71038c3 rc1210b1  
    1111DIRS="\
    1212  apps/routerconsole/locale \
     13  apps/routerconsole/locale-news \
    1314  apps/i2ptunnel/locale \
    1415  apps/i2ptunnel/locale-proxy \
Note: See TracChangeset for help on using the changeset viewer.