hi
po are only human readable container for the text<->translation strings
when running the cw3setup script, the .po get compilated by gettext into
binary .mo, these files are located in
cartoweb3/locale/*langcode*/LC_MESSAGES/*projectid.projectid.projectid*.mo
these are the files actualy used by gettext to do the string replacement in
real time.
the .po contains the string you want to translate.
For convenience, cartoweb include 2 scripts one can use to generate some
basic .mo for a given project: client2pot and server2pot.
These script simply look inside all the files of your project for every
strings included into I18n::gt(...) call (in php file) or into {t}...{/t}
tag (in templates files). additionaly, the server2pot also get all the
layer's labels from either the layers.ini file or the mapfile.
dynamicaly generated strings will not get "recovered" by those scripts
unless someone provided some fake/hidden {t}..{/t} or I18n::gt(...), for
example for the tools's labels.
client.po, server.*projectid*.po, server.po contain the raw (untranslated)
list of strings for a given project.
msgid "IdRecentering"
msgstr ""
client.en.po, server.*projectid*.en.po, server.en.po are COPIES!!! of the
raw .po but this time they ALSO contain the translated strings for the
corresponding language.
msgid "IdRecentering"
msgstr "Identifiers recentering"
to quickly add translations to your projects, you can easily copy the
existing .po files provided in cartoweb by default and modify them. You will
have some extra translated/unwanted strings but nothing that cant be easily
modified/removed if needed.
copy ALL the .po files into your project's po folder.
look at an existing demo /po folder to see whats there.
if you want "clean" po files, you need to run the client2pot and server2pot
scripts to generate the RAW po files for your project and then COPY these
files and rename them with the extra 2 letters lang tag (.po > .en.po) and
EDIT them to add the translations for all the strings you want.
I would suggest moving/deleting all .po existing in cartoweb3/po/ BEFORE
doing that, as if some .po already exist, the script will try to merge their
content with the newly extracted content, which may be problematic.
so once you have emptied the /po folder, go to /cartoweb3/scripts/ and run
the command "php client2pot.php *yourprojectid*" and "php server2pot.php
*yourprojectid*"
if you see ("zoomin", "query_by_bbox") it means the strings are NOT
translated.
check that gettext is installed and that it works correctly (see
documentation on how to test that
http://www.cartoweb.org/doc/cw3.5/xhtml/user.i18n.html#user.i18n.translations.debug)
restart Apache too.
gettext is a bit buggy and sometimes you need to restart Apache to see the
modification you did in the .po files even after you have run the cw3setup
script to generate the .mo
regards
Oliver
----- Original Message -----
From: "Chris Duncan, GISmatters" <[EMAIL PROTECTED]>
To: "Cartoweb Users" <cartoweb-users@lists.maptools.org>
Sent: Wednesday, October 15, 2008 11:30 PM
Subject: [Cartoweb-users] Confused about .po files
I am *not* trying to internationalize my application -- for our user base
and local application, there's no need to support any other language than
English.
I would like, however, to change some of the text that appears (for
example, in the tips that pop up when you hover over a tool like the
zoom-in tool).
I have tried to understand the system of .po files (defaults,
project-specific, alternate languages, sources vs. generated, etc), but
have become completely confused. I have not found enough info in the
documentation or wiki to clear up my confusion.
Could someone please provide a simple, clear, concise discussion of the
following (if you don't have lots of time to answer, then please just skip
to item (c) which is my most urgent question):
(a) When, and in what order, do .po files get used? For one thing, I'm
confused about what happens when I refresh the installation using cw3setup
vs. what happens at runtime when someone is using the site. I see that
there are *generated* .po files in the htdocs/po folder... I assume
*those* are the ones that actually provide text to the application at
runtime. But even there I find "default" and project-specific folders and
files. Where do "source" files live, and what is the chain of processing
that converts and/or merges them to create the ones I see in htdocs/po?
(b) When do language-specific files get used? If there is both a client.po
and client.en.po file, which one gets used? What is the interaction of the
"generic" vs. the "language-specific" .po files?
(c) Last, but most important to me at this time: Suppose I wanted to
change the hover-text of the "zoom in" button to say "Choose this tool and
click on the map to zoom in" (we have some very un-savvy users!). What
specific steps do I follow to make that change in the recommended way? My
project currently has *no* po folder or files... do I copy them from
<cartowebhome>/po and then modify them? Do I need to run server2pot.php
and client2pot.php to initialize them in some way? I'm totally lost on how
to proceed...
One final detail that adds to my confusion: on my development machine
(WinXP, Apache server) I get message text like "Zoom in" or "Query by
rectangle" when I hover over the tools; when I upload my project to the
live web server (Windows Server, IIS) the tips are the message IDs instead
of the text ("zoomin", "query_by_bbox"). Why do they differ?
Thanks in advance to any of you who can help me understand this! Cheers,
Chris
--
Chris Duncan, Ph.D.
President
GISmatters
[EMAIL PROTECTED]
http://www.gismatters.com/
1 Tuckerman Ln
Amherst, MA 01002
Tel: 413-549-2052
Fax: 508-637-2557
_______________________________________________
Cartoweb-users mailing list
Cartoweb-users@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users
_______________________________________________
Cartoweb-users mailing list
Cartoweb-users@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/cartoweb-users