Read me
A easy way to multilingo your zope application
Description
This product uses browser's language sets to translate message unless defined favorite_language
in cookies
in its ZMI interface, there are interfaces to show untranslated messages and or translated messages,and you can translate it online.
API
i18n is the instance id for MiniI18N class
i18n(s) : return translated message in first language defined in REQUEST.HTTP_ACCEPT_LANGUAGE for s,if s is not translated in that language,return s itself
i18n.change_runmode(mode) : change run mode, the default mode is dev
,it mean the untranslated messages list will growing up when it miss translatation to the specified language. in other run mode,the miss translated messages list will not growing.
Programmer Guide
the i18n folder contain predefined languages, each subfolder for a single language, the subfolder name must be the languange name accepted from browser. MiniI18N will search all the msg.txt files under subfolders under i18n folder when its instance is created. the msg.txt format will be describe below.
code with i18n to translate message.
in script:
# get i18n instance,here we get it from container,maybe anywhere.
i18n = container.i18n
# translate message
hint_msg=i18n(Hi,World, This is MiniI18N
)
print hint_msg
in DTML:
in Page template:
Translate message online
when i18n run_code in dev
,after you program run with specified language,in i18n instance,you can get all untranslated messages list in a textarea box,you can translate it online by add the translated text after :
,and press the translating
button (this button also can be translated).
msg.txt format
comment start with #
each line define a message translattion entry.
source message string and target message string is splited by :
\x3A
stand for :
if it exists in source or target
\x0A
stand for \n
\\
stand for \
\x0D
stand for \r
dependence
- fileUtilities
- a set of python functions to load some of zope Objects (include dtml method,file,image,page template,python script,etc SecurtyUtils -- a easy way to setup class security.
download:
http://www.zope.org/Members/zoping/MiniI18N/MiniI18N.tgz
installation:
unpack MiniI18N.tgz at
Create MiniI18N instance
Login on to your zope ZMI.
at your application root folder,choose MiniI18N content type and press add button,and it will add a MiniI18N instance with id i18n
Support:
My email address: [email protected],bug report are welcome,