Hi,
A soon-to-be happy new year to everyone!
I'm 100% new to this i18n lark and my approach so far has been to create
a .mo file per module in my app.
My thinking was, why load one huge .mo file when a single module only needs
a few strings? Since then, it seems, I have made the wrong decision.
For example I have module A that imports module B. Each one does this:
gettext.install( domain, localedir, unicode = True )
lang = gettext.translation(domain, localedir, languages = [ loc ] )
lang.install(unicode = True )
(where doman is the name of the module, so "A" and "B")
The problem is that domain "A" loads and then import B happens and so
the "lang" reference (I think) gets replaced by domain "B" -- the result is
that module A can only translate strings that are in domain "B".
How does one 'merge' gettext.translations objects together? Or is that
insane?
What's the best way to handle a project with multiple domain.mo files?
I hope someone can give me some advice.
\d 4 1402
On Dec 28, 12:01 pm, Donn Ingle <donn.in...@gmail.comwrote:
Hi,
A soon-to-be happy new year to everyone!
I'm 100% new to this i18n lark and my approach so far has been to create
a .mo file per module in my app.
My thinking was, why load one huge .mo file when a single module only needs
a few strings? Since then, it seems, I have made the wrong decision.
For example I have module A that imports module B. Each one does this:
gettext.install( domain, localedir, unicode = True )
lang = gettext.translation(domain, localedir, languages = [ loc ] )
lang.install(unicode = True )
(where doman is the name of the module, so "A" and "B")
The problem is that domain "A" loads and then import B happens and so
the "lang" reference (I think) gets replaced by domain "B" -- the result is
that module A can only translate strings that are in domain "B".
How does one 'merge' gettext.translations objects together? Or is that
insane?
What's the best way to handle a project with multiple domain.mo files?
I hope someone can give me some advice.
\d
I've never messed with .mo files, but a little "googling" turned up
this interesting module on PyPI: http://cheeseshop.python.org/pypi?%3...rch&term=polib
If you're messing with unicode in general, I've heard this is a good
article to read: http://kevino.theolliviers.com/python-unicode.html
This article looks related, although the author is using .po instead
of .mo files: http://www.learningpython.com/2006/1...k-application/
Finally, I found a wxPython specific one that looks like it might be
general enough for you: http://wiki.wxpython.org/Internationalization
I hope that gives you some ideas anyway.
Mike
Thanks for taking the time to post those links. I have read most of them
before. They don't seem to cover the basic issue in my OP, but i18n on
Python is a dark art and maybe there's something I missed.
\d
* Donn Ingle (Fri, 28 Dec 2007 20:01:48 +0200)
I'm 100% new to this i18n lark and my approach so far has been to create
a .mo file per module in my app.
My thinking was, why load one huge .mo file when a single module only needs
a few strings? Since then, it seems, I have made the wrong decision.
For example I have module A that imports module B. Each one does this:
gettext.install( domain, localedir, unicode = True )
lang = gettext.translation(domain, localedir, languages = [ loc ] )
lang.install(unicode = True )
(where doman is the name of the module, so "A" and "B")
The problem is that domain "A" loads and then import B happens and so
the "lang" reference (I think) gets replaced by domain "B" -- the result is
that module A can only translate strings that are in domain "B".
How does one 'merge' gettext.translations objects together? Or is that
insane?
What's the best way to handle a project with multiple domain.mo files?
I can give you just general advice how I dealt with
internationalization in my example app. "scipt" is the main app with
its own mo file and imports optparse which has again its own mo file
#
gettext.textdomain('optparse')
gettext.install('script', unicode = True)
from optparse import OptionParser, \
OptionGroup
# [...]
Thorsten
Thorsten Kampe wrote:
gettext.textdomain('optparse')
gettext.install('script', unicode = True)
They speak of a 'global' domain in the docs, but (as is my usual beef with
the Python docs -- see PHP docs for sterling help) there is no clarity.
It *sounds* like there can be a .mo file for *everything* and then one can
also install others on a per-script/module basis, as your code seems to
suggest.
All very confusing.
I have had an entire day to stew and I spent it combining all my po files
into one big file. Now I install that once, and efficiency be damned.
Still, I'm interested in what's possible and I'll give your approach a
whirl.
Don't let the thread die yet, c'mon you i18n boffins!
Thanks,
\d This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ProgDario |
last post by:
HI,
I downloaded and installed the I18N pear package, but the link on the
doc referring to the DB is broken.
Where can I find the I18N DB? Without it I can't make it work!
Thanks in...
|
by: Logan |
last post by:
Is it possible to tell the wxPython widgets (e.g. file dialogs)
to use another language (instead of English)?
Thanks in advance for any hints!
--
mailto: logan@phreaker(NoSpam).net
|
by: Albretch |
last post by:
.. Can you define the Character Set for particular tables instead of
databases?
. Which DBMSs would let you do that?
. How do you store in a DBMS i18n'ed users' from input, coming over
the web...
|
by: Guido Wesdorp |
last post by:
Hi!
I've just released a JavaScript library to allow internationalizing
JavaScript code and/or to do HTML translation from JavaScript. It's a
first release, and it doesn't have all the features...
|
by: Laszlo Zsolt Nagy |
last post by:
Hello,
I wonder if there is a standard for making i18n in Python projects. I
have several Python projects that are internationalized. I also have
Python packages with i18n. But it is still not...
| |
by: Darren Davison |
last post by:
Hi,
I have a documentation tool based on Java and XSLT that I want to add i18n
capability to. There are around 8 stylesheets that process a Source
generated by the Java code and some of the...
|
by: Alan J. Flavell |
last post by:
OK, I guess I'm about ready to expose this page for public discussion:
http://ppewww.ph.gla.ac.uk/~flavell/charset/i18n-weft.html
Please concentrate on the content. I'm well aware that my old...
|
by: i18n-bounces |
last post by:
Your mail to 'I18n' with the subject
Mail Delivery (failure i18n@mova.org)
Is being held until the list moderator can review it for approval.
The reason it is being held:
Post by...
|
by: Norman Diamond |
last post by:
My C# code is I18N'ed by appropriately naming and editing .resx files. At
execution time, it works.
My C++ code is somewhat I18N'ed. When I put UI code in C++ I use .rc files.
When I link to a...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |