зеркало из https://github.com/mozilla/domesday.git
Moving compile-mo into bin and integrating locale/README into docs
This commit is contained in:
Родитель
f17312771e
Коммит
0f6622c374
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
# syntax:
|
||||
# compile-mo.sh locale-dir/
|
||||
|
||||
function usage() {
|
||||
echo "syntax:"
|
||||
echo "compile.sh locale-dir/"
|
||||
exit 1
|
||||
}
|
||||
|
||||
# check if file and dir are there
|
||||
if [[ ($# -ne 1) || (! -d "$1") ]]; then usage; fi
|
||||
|
||||
for lang in `find $1 -type f -name "*.po"`; do
|
||||
dir=`dirname $lang`
|
||||
stem=`basename $lang .po`
|
||||
msgfmt -o ${dir}/${stem}.mo $lang
|
||||
done
|
|
@ -30,6 +30,7 @@ Contents
|
|||
gettingstarted
|
||||
libs
|
||||
l10n_setup
|
||||
l10n_update
|
||||
|
||||
|
||||
Indices and tables
|
||||
|
|
|
@ -6,21 +6,29 @@ So you'd like to localize your webapp. **Congratulations!**
|
|||
Playdoh comes with all of the libraries and tools you need
|
||||
in the dev and production requirements.
|
||||
|
||||
Requirements
|
||||
------------
|
||||
|
||||
The one set of low level tools not provided is gettext.
|
||||
|
||||
::
|
||||
|
||||
aptitutde install gettext
|
||||
|
||||
Steps
|
||||
-----
|
||||
|
||||
The following steps will get you started:
|
||||
|
||||
#. Create a SVN reposity based on MDN_ locale directory.
|
||||
This will give you a README.txt, compile-mo.sh, and
|
||||
show you the proper directory layout.
|
||||
#. Create a SVN reposity with directories based on MDN_
|
||||
locale directory. Playdoh comes with bin/complie-mo.sh
|
||||
#. Compile the po files and mirror the SVN repository in a
|
||||
git repository via a cron job that runs every 15 minutes.
|
||||
Example: (TBD)
|
||||
/home/fwenzel/bin/autol10n/autol10n.sh
|
||||
#. Add your git repo as an external to this project
|
||||
It should create a locale directory at the top level
|
||||
#. Read locale/README.txt for a better understanding of
|
||||
#. Read the next section L10n udpate for a better understanding of
|
||||
what Django management commands are used to extract and
|
||||
merge strings into your po files. It has instructions
|
||||
for adding more locales.
|
||||
|
@ -28,7 +36,6 @@ The following steps will get you started:
|
|||
Q&A
|
||||
---
|
||||
Why SVN? Our localizers like to use either SVN or Verbatim.
|
||||
|
||||
Why a git repo to mirror an SVN repo? This allows us to have an external reference and update easily.
|
||||
|
||||
.. _MDN: http://svn.mozilla.org/projects/mdn/trunk/locale/
|
||||
|
|
|
@ -0,0 +1,43 @@
|
|||
L10n Update
|
||||
===========
|
||||
|
||||
Follow these steps to update strings for L10n.
|
||||
|
||||
We are using English strings for gettext message ids.
|
||||
|
||||
Environment Setup
|
||||
-----------------
|
||||
|
||||
Your top level directory named locale should be an SVN repository.
|
||||
This is because we will generate files there and we'll
|
||||
commit via SVN. Developers who never deal with L10n
|
||||
do not need to worry about this kind of setup. It's often
|
||||
easier to have a L10n dev setup, which a cron job updates
|
||||
the sources, updates the strings, and compiles the po
|
||||
files and lastly commiting to SVN.
|
||||
|
||||
Instructions:
|
||||
-------------
|
||||
|
||||
1. ``./manage.py extract ``
|
||||
2. ``./manage.py verbatimize --rename``
|
||||
This will copy the POT files created in step 1 to templates/LC_MESSAGES
|
||||
3. ``./manage.py merge``
|
||||
|
||||
Optional:
|
||||
---------
|
||||
|
||||
4. ``locale/compile-mo.sh locale``
|
||||
|
||||
New Locales:
|
||||
------------
|
||||
|
||||
Assuming you want to add 'fr':
|
||||
|
||||
#. ``mkdir -p locale/fr/LC_MESSAGES``
|
||||
#. ``./manage.py merge``
|
||||
|
||||
or
|
||||
|
||||
#. ``msginit --no-translator -l fr -i templates/LC_MESSAGES/messages.pot -o fr/LC_MESSAGES/messages.po``
|
||||
#. repeat for other POT files
|
Загрузка…
Ссылка в новой задаче