Hey Marko ... feel free to use some .po files I've been building over at https://github.com/OpenTransitTools/view/tree/master/ott/view/locale. I'm thinking a fair number of the strings I've localized into Spanish will map to strings within the Leaflet client.BTW, here you can see these localizations work against an OTP backend here:- and -It would benefit me to know that the .po files that I've been using with Babel / Pyramid / Python also work with other libraries like Pomo / JsGettext.
On Thursday, March 20, 2014 12:43:02 AM UTC-7, Marko Burjek wrote:Is anyone working on this?
If not I will look into it because I need localization in local deployment.
I will compare JsGettext and Pomo to see which is better. They both support gettext po files. Pomo seems to be more modern jsgettext is 5 years old. I also found Jed and i18next but first seem to only works on node-js I have to look into i18next. Anybody knows any other js gettext library?I would like to know which branch to branch for this and on what client to work? Openlayers or Leaflet. And is Openlayers abandoned because it doesn't work on master?
I posted something on the tracker on issue #261
On Monday, 3 May 2010 20:48:29 UTC+2, Karel wrote:I have created 3 new tickets for this based on this thread (261-263).
karel
On Sat, 2010-05-01 at 05:15 -0700, Frank wrote:
> To clarify, I'm seeing the proposal shaping up like this:
>
> 1. move the exiting English.js and Spanish.js translation content over
> to gettext Portable Object (PO) files
> 2. use jsgettext within the .js webapp to read the PO, and translate
> our strings.
>
> That's great. I'm +1 on this idea, with the addition that we maintain
> the PO translation files in a single place available for use
> throughout the project, to both java and javascript modules (as
> opposed to locking translations away in the webapp / javascript
> specific). My question is in what module do we house the PO files?
> Do we use an exiting module (e.g., opentripplanner-utils) or create a
> new module (e.g., opentripplanner-localizations)?
>
> On Apr 26, 8:49 am, Nicholas Bergson-Shilcock
> <nichola...@openplans.org> wrote:
> > Excerpts from jvhigon's message of Mon Apr 26 01:34:58 -0400 2010:
> >
> > > Hello,
> > > I've never used jsgettext so I can't help doing a patch at this moment
> > > (I could contribute with the changes that I commented few days ago).
> > > The approach with gettext seems to be better than the OpenLayers
> > > solution (I don't know if OL have already worked this problem out). I
> > > wiil wait for your answer in order to do the patch.
> >
> > If Dave or I took a pass at moving what's currently localized to the gettext
> > system, would you be able to then help out in bringing some of the remaining
> > items (e.g., those listed in ticket #220http://opentripplanner.org/ticket/220)
> > over to the new system?
> >
> > -Nick
> >
> >
> >
> > > Regards
> >
> > > On 23 abr, 21:36, Karel Novotny <novotny.ka...@gmail.com> wrote:
> > > > On Fri, 2010-04-23 at 13:00 -0400, David Turner wrote:
> > > > > Actually, question: how does this deal with plurals? Because I just
> > > > > found myself writing code to deal with plurals and realized that if I
> > > > > had to do very much of that, I would go mad:
> >
> > > > > <tpl if="duration != 1.0">{[this.locale.time.minute]}</tpl>)<tpl
> > > > > if="duration != 1.0">{[this.locale.time.minutes]}</tpl>)</span></tpl>
> >
> > > > > Also, it would not work for languages like Polish which have a separate
> > > > > forms not just for 1 and n, but also for other numbers.
> >
> > > > > See this:
> > > > >http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html
> >
> > > > I am glad you brought this up. I am czech and haven't actually realized
> > > > that just '1 vers. many' system doesn't work for my language either.
> >
> > > > karel
> >
> > > > > On Fri, 2010-04-23 at 12:34 -0400, David Turner wrote:
> > > > > > This sounds good to us. Would you be willing to write a patch to do
> > > > > > this?
> >
> > > > > > On Fri, 2010-04-23 at 02:34 -0700, jvhigon wrote:
> > > > > > > Hi everyone,
> > > > > > > I would like to propose a new way to deal with multilanguage in OTP..
> > > > > > > That is, using the Openlayers approach.
> > > > > > > The steps would be the following:
> > > > > > > 1.- It would be a javascript file for each language. This file would
> > > > > > > extend the OpenLayers file defined for this language. For example:
> >
> > > > > > > OpenLayers.Lang.en_otp = OpenLayers.Util.extend(OpenLayers.Lang.en, {
> > > > > > > 'key' : 'translation_in_otp_code',
> > > > > > > ...
> > > > > > > CLASS_NAME: "OpenLayers.Lang.en_otp"
> > > > > > > });
> >
> > > > > > > 2.- The language would be set at the beginning of the application,
> > > > > > > using an OpenLayers function. For example:
> >
> > > > > > > OpenLayers.Lang.setCode('en_otp');
> >
> > > > > > > 3.- The translatiosn would be done with another OpenLayers function:
> >
> > > > > > > OpenLayers.Lang.translate('key')
> >
> > > > > > > By the way, there is some source code that is not able to be
> > > > > > > translated like "Templates.js" . With this new approach the changes
> > > > > > > would be as described below:
> >
> > > > > > > Now:
> > > > > > > TP_START : new Ext.XTemplate(
> > > > > > > '<h4><a href="#">Start at</a> {name}</h4>'
> > > > > > > ).compile(),
> >
> > > > > > > With OpenLayers approax
> >
> > > > > > > TP_START = new Ext.XTemplate(
> > > > > > > '<h4><a href="#">' + OpenLayers.Lang.translate('start_at')
> > > > > > > + '</a> {name}</h4>'
> > > > > > > ).compile();
> >
> > > > > > > What do you think?
> >
> > > > > > > Regards
> >
> > > > --
> > > > Subscription settings:http://groups.google.com/group/opentripplanner-dev/subscribe?hl=en
--
You received this message because you are subscribed to a topic in the Google Groups "OpenTripPlanner Developers" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/opentripplanner-dev/KLdzJdmx94k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to opentripplanner...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner...@googlegroups.com.
2014-05-19 16:29 GMT+02:00 Andrew Byrd <and...@fastmail.net>:
Hello Marko,
Thanks for the update, and thanks for all this work on internationalizing OTP.
It's good that you've created a reproducible process for extracting strings and working on translations, but it seems unlikely to me that the casual translator will want to install all the tooling to go through this process. When I look at the final result (the JSON file that is actually loaded by the JS library) it strikes me that it would be very easy to just duplicate this file and edit it directly:
https://github.com/buma/OpenTripPlanner/blob/po_localization/otp-leaflet-client/src/main/webapp/js/otp/locale/sl.json
Is there any reason why we should discourage people from supplying translations this way?
"Depart_tripoptions": ""They are both Depart in english. How to translate them depends on usage. In json file only context (word behind _) is retained but in po file you have everything you need to have (Translator comments, where this happens if you need to look etc..):
"Depart_itinerary": "",
#. Depart on to street / Board at station in itineraryPlurals
#: otp-leaflet-client/src/main/webapp/js/otp/modules/planner/ItinerariesWidget.js:536
#, fuzzy
msgctxt "itinerary"
msgid "Depart"
msgstr ""
#. Depart [time dropdown] [date dropdown]. Used in
#. dropdown as a label to choose wanted time/date of departure
#: otp-leaflet-client/src/main/webapp/js/otp/widgets/tripoptions/TripOptionsWidget.js:312
msgctxt "tripoptions"
msgid "Depart"
msgstr ""
"every %d min_plural_5": "","every %d min": "","every %d min_plural_2": "","every %d min_plural_3": "",
Because we have 4 different plural forms. (Most languages have less).
But each translator would need to know how should he change that.
In gettext this is only one command away. (msginit -i messages.pot -o lang.po -l lang).
Updating
Now when new translations are added they are merged with all existing languages with one command.
And we always now for each file how complete translation is.
Because we have po files. But if we have only json file from a translator this is a manual process.
And we could have translations we woudln't know are incomplete.
Tooling support
For gettext translation exist a lot of programs. For example:
http://userbase.kde.org/Lokalize
http://virtaal.translatehouse.org/
http://poedit.net/
http://www.gted.org/ (Plugin for Eclipse)
https://localise.biz/free/poedit (freely usable from a browser, you don't even have to register)
Most of them support translation memory (So that you can use other translations if same string is used),
web translating services to easy translating, setting
correctness of translation(Fuzzy usually means you are not sure that translation is correct), checking string correctness
(If original string has space and the end, translation needs to have it too, parameter correctness etc..)
They are GUI programs.
And also we could send translation template (Pot file) to https://www.transifex.com (It's free for OSS projects) or
https://help.launchpad.net/Translations/StartingToTranslate .
So that making translations is even easier and nobody needs to install anything.
I think that with using json for translation we would have similar problem then now with js files where some are complete,
some are not, but you are not really sure.
You mention "changing Makefile that it also installs necessary programs, try to use as much translations as possible when porting language.js translation files to po." Considering the variety of platforms that people are running OTP on, I'm not sure changing the Makefile to install software would be a good idea. It's very likely that only one or two people will be working with your entire PO/POT toolchain and a HOWTO document would be more helpful. I also don't really understand how changing this Makefile would help with porting the old language files to the new system. Can you elaborate?
Then I'll just write a HOWTO it is probably better.
Makefile isn't used for old translations. I think you probably misunderstood me. I'm writing a script that will use
translations from old *.js files to bootstrap new gettext translations.I also added translations for Geocoder and found that dialogs are mostly used in fieldTrip and callTaker which
I would leave for now.I still want to know if you can help me How would I get trip with absolute directions?
Unfortunately I can't help you much with setting up the calltaker and fieldtrip interfaces, as I have not worked on them. Work is still continuing on those, so it may be more practical to internationalize them at a later date.
-Andrew
Thanks Marko for explaining all of this. I can see how having the translation comments, context, and proper labeling of plural forms is important, so it's not practical for people to just hack directly on the JSON.
You mention that "Now when new translations are added they are merged with all existing languages with one command." At this point you probably understand the process much better than the rest of us, so it will be important for you to contribute step-by-step instructions for updating the template and individual translations.
Can we also count on you to be the i18n maintainer?
I am still a little concerned that we'll see a drop in translation contributions due to perceived complexity. But I suppose that's the price of "doing it right". I guess we can always prepare the PO file for a volunteer translators and point them to a tool, online if necessary.
On 05/19/2014 05:49 PM, Marko Burjek wrote:
I suppose the HTTP Accept-language header is also an option. However, we require more than just language information -- we need to localize date formats (ugh) and units.I am at an end of what I can translate in a frontend. Errors and notes etc.. can only be translated in Java. I have a question should I change an API to add language parameter to all calls that could return strings? or does anyone have a better idea how to solve this?
I don't think we have the spare dev capacity to work on translating backend strings at the moment. Or are you offering to do the coding? Perhaps it is most important to get the frontend translation process in place first.
-Andrew
--
You received this message because you are subscribed to the Google Groups "OpenTripPlanner Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opentripplanner-dev+unsub...@googlegroups.com.