Skip to content

Commit

Permalink
Moving compile-mo into bin and integrating locale/README into docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ozten committed Jan 14, 2011
1 parent f173127 commit 0f6622c
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 5 deletions.
19 changes: 19 additions & 0 deletions bin/compile-mo.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Contents
gettingstarted
libs
l10n_setup
l10n_update


Indices and tables
Expand Down
17 changes: 12 additions & 5 deletions docs/l10n_setup.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,36 @@ 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.

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/
43 changes: 43 additions & 0 deletions docs/l10n_update.rst
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 0f6622c

Please sign in to comment.