forked from I2P_Developers/i2p.www
Split translation strings between multiple domains
This breaks translation processing; multi-domain support needs to be added to Flask-Babel. The changes made here put the "important" strings that are used most often into the priority domain, and split the content from different sub-urls into separate domains. Multi-domain support will be implemented such that translations for a specific request are pulled both from the domain which corresponds to the request url and the priority domain. This does mean that there may be duplication of translation strings between domains, but that is unavoidable (and the translators prefer working with smaller resource files).
This commit is contained in:
@ -1,2 +1,2 @@
|
|||||||
env
|
env
|
||||||
.*\.pot
|
pots
|
||||||
|
2
babel.cfg/about
Normal file
2
babel.cfg/about
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[jinja2: **/pages/site/about/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
2
babel.cfg/blog
Normal file
2
babel.cfg/blog
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[jinja2: **/blog/**.rst]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_
|
2
babel.cfg/comparison
Normal file
2
babel.cfg/comparison
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[jinja2: **/pages/site/comparison/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
2
babel.cfg/docs
Normal file
2
babel.cfg/docs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[jinja2: **/pages/site/docs/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
2
babel.cfg/get-involved
Normal file
2
babel.cfg/get-involved
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[jinja2: **/pages/site/get-involved/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
2
babel.cfg/misc
Normal file
2
babel.cfg/misc
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[jinja2: **/pages/site/misc/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
12
babel.cfg/priority
Normal file
12
babel.cfg/priority
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[jinja2: **/pages/blog/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
||||||
|
[jinja2: **/pages/download/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
||||||
|
[jinja2: **/pages/global/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
||||||
|
[jinja2: **/pages/global/macros]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_
|
||||||
|
[jinja2: **/pages/meetings/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
||||||
|
[jinja2: **/pages/site/*.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
2
babel.cfg/research
Normal file
2
babel.cfg/research
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[jinja2: **/pages/site/research/**.html]
|
||||||
|
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
@ -1,7 +0,0 @@
|
|||||||
[python: **.py]
|
|
||||||
[jinja2: **/pages/**.html]
|
|
||||||
extensions=jinja2.ext.autoescape,jinja2.ext.with_,i2p2www.extensions.HighlightExtension
|
|
||||||
[jinja2: **/pages/global/macros]
|
|
||||||
extensions=jinja2.ext.autoescape,jinja2.ext.with_
|
|
||||||
[jinja2: **/blog/**.rst]
|
|
||||||
extensions=jinja2.ext.autoescape,jinja2.ext.with_
|
|
@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. ./babel/translation.vars
|
. ./translation.vars
|
||||||
|
|
||||||
TZ=UTC env/bin/pybabel compile -d $TRANSDIR
|
for domain in $(ls $BABELCFG); do
|
||||||
|
TZ=UTC env/bin/pybabel compile -D $domain -d $TRANSDIR
|
||||||
|
done
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. ./babel/translation.vars
|
. ./translation.vars
|
||||||
|
|
||||||
TZ=UTC ./pybabel extract --msgid-bugs-address="http://trac.i2p2.de" \
|
if [ ! -e $POTDIR ]; then
|
||||||
|
mkdir $POTDIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
for domain in $(ls $BABELCFG); do
|
||||||
|
TZ=UTC ./pybabel extract --msgid-bugs-address="http://trac.i2p2.de" \
|
||||||
--project=$PROJECT \
|
--project=$PROJECT \
|
||||||
--version=$VERSION \
|
--version=$VERSION \
|
||||||
-F $BABELCFG \
|
-F $BABELCFG/$domain \
|
||||||
-o $POTFILE $PROJDIR
|
-o $POTDIR/$domain.pot $PROJDIR
|
||||||
|
done
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. ./babel/translation.vars
|
. ./translation.vars
|
||||||
|
|
||||||
if [ $# -ge 1 ]
|
if [ $# -ge 1 ]
|
||||||
then
|
then
|
||||||
TZ=UTC env/bin/pybabel init -i $POTFILE -d $TRANSDIR -l $1
|
for domain in $(ls $BABELCFG); do
|
||||||
|
TZ=UTC env/bin/pybabel init -D $domain -i $POTDIR/$domain.pot -d $TRANSDIR -l $1
|
||||||
|
done
|
||||||
else
|
else
|
||||||
echo "Usage: ./init-new-po.sh lang"
|
echo "Usage: ./init-new-po.sh lang"
|
||||||
fi
|
fi
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
PROJECT=I2P
|
PROJECT=I2P
|
||||||
VERSION=website
|
VERSION=website
|
||||||
CONFDIR=babel
|
BABELCFG=babel.cfg
|
||||||
|
POTDIR=pots
|
||||||
PROJDIR=i2p2www
|
PROJDIR=i2p2www
|
||||||
BABELCFG=$CONFDIR/babel.cfg
|
|
||||||
POTFILE=messages.pot
|
|
||||||
TRANSDIR=$PROJDIR/translations
|
TRANSDIR=$PROJDIR/translations
|
@ -1,4 +1,6 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
. ./babel/translation.vars
|
. ./translation.vars
|
||||||
|
|
||||||
TZ=UTC env/bin/pybabel update -i $POTFILE -d $TRANSDIR
|
for domain in $(ls $BABELCFG); do
|
||||||
|
TZ=UTC env/bin/pybabel update -D $domain -i $POTDIR/$domain.pot -d $TRANSDIR
|
||||||
|
done
|
||||||
|
Reference in New Issue
Block a user