I just wanted to let the i18n group know that I today implemented localization with po (gettext portable object) files. Based on a number of comments I received in the past week, including a few from our very knowledgeable l10n team at Mozilla, I decided to at least give the po a stab. It turns out that using the jsgettext library (http://developer.berlios.de/projects/jsgettext/ ) I could get it working in less than a day. This change will open Ubiquity command localization up to the vast resources and tools of the po world.
One particular advantage of po is that it is a truly bilingual format, so the source text can be right there as a reference. There are no particular format restrictions on the keys (message ID's, or msgid), as opposed to properties files. There also is a message context (msgctxt) property which helps keep the msgid's less cluttered. Here's an example entry from firefox.ja.po which I was using to test:
msgctxt "zoom.preview" msgid "Zooms the Firefox window to ${replacement} of its normal size." msgstr "ウインドウを通常の${replacement}のサイズで表 示。"
So here's the string "Zooms the Firefox window to ${replacement} of its normal size." in the context of the preview() of the zoom command, and its Japanese equivalent. Properties (like names) don't take contexts and look like this:
msgid "zoom.names" msgstr "ズーム|ズームして|ズームする|ズームしろ"
I also updated the localization template tool to produce po-formatted templates (often called .pot). You can go to the command list and click on a feed's "get localization template" link to get the template. The localization template tool's recognition of _()'d strings in preview and execute are imperfect, but they will hopefully pick up a good number of the strings required in localization. If it's missing some, of course, you can add your own entries to the po file. Moreover, many strings in commands have yet to be _()'d... we'd appreciate anyone who wants to pitch in and make some more commands localizable as well.
> I just wanted to let the i18n group know that I today implemented
> localization with po (gettext portable object) files. Based on a
> number of comments I received in the past week, including a few from
> our very knowledgeable l10n team at Mozilla, I decided to at least
> give the po a stab. It turns out that using the jsgettext library (http://developer.berlios.de/projects/jsgettext/ > ) I could get it working in less than a day. This change will open
> Ubiquity command localization up to the vast resources and tools of
> the po world.
> One particular advantage of po is that it is a truly bilingual format,
> so the source text can be right there as a reference. There are no
> particular format restrictions on the keys (message ID's, or msgid),
> as opposed to properties files. There also is a message context
> (msgctxt) property which helps keep the msgid's less cluttered. Here's
> an example entry from firefox.ja.po which I was using to test:
> msgctxt "zoom.preview"
> msgid "Zooms the Firefox window to ${replacement} of its normal size."
> msgstr "ウインドウを通常の${replacement}のサイズで表
> 示。"
> So here's the string "Zooms the Firefox window to ${replacement} of
> its normal size." in the context of the preview() of the zoom command,
> and its Japanese equivalent. Properties (like names) don't take
> contexts and look like this:
> I also updated the localization template tool to produce po-formatted
> templates (often called .pot). You can go to the command list and
> click on a feed's "get localization template" link to get the
> template. The localization template tool's recognition of _()'d
> strings in preview and execute are imperfect, but they will hopefully
> pick up a good number of the strings required in localization. If it's
> missing some, of course, you can add your own entries to the po file.
> Moreover, many strings in commands have yet to be _()'d... we'd
> appreciate anyone who wants to pitch in and make some more commands
> localizable as well.
What do I need to do to make strings _() able? Can you point me at
some documentation or examples for that? I am currently going through
all the standard feeds renaming commands for the Overlord Verbs
standard, so I might as well _() ify them at the same time, once I
know how.
--Jono
On Mon, Jun 15, 2009 at 6:54 PM, Blair McBride<unfocu...@gmail.com> wrote:
> Impressive!
> - Blair
> On 16/06/09 3:23 AM, "mitcho (Michael 芳貴 Erlewine)" wrote:
>> Hi all,
>> I just wanted to let the i18n group know that I today implemented
>> localization with po (gettext portable object) files. Based on a
>> number of comments I received in the past week, including a few from
>> our very knowledgeable l10n team at Mozilla, I decided to at least
>> give the po a stab. It turns out that using the jsgettext library (http://developer.berlios.de/projects/jsgettext/ >> ) I could get it working in less than a day. This change will open
>> Ubiquity command localization up to the vast resources and tools of
>> the po world.
>> One particular advantage of po is that it is a truly bilingual format,
>> so the source text can be right there as a reference. There are no
>> particular format restrictions on the keys (message ID's, or msgid),
>> as opposed to properties files. There also is a message context
>> (msgctxt) property which helps keep the msgid's less cluttered. Here's
>> an example entry from firefox.ja.po which I was using to test:
>> msgctxt "zoom.preview"
>> msgid "Zooms the Firefox window to ${replacement} of its normal size."
>> msgstr "ウインドウを通常の${replacement}のサイズで表
>> 示。"
>> So here's the string "Zooms the Firefox window to ${replacement} of
>> its normal size." in the context of the preview() of the zoom command,
>> and its Japanese equivalent. Properties (like names) don't take
>> contexts and look like this:
>> I also updated the localization template tool to produce po-formatted
>> templates (often called .pot). You can go to the command list and
>> click on a feed's "get localization template" link to get the
>> template. The localization template tool's recognition of _()'d
>> strings in preview and execute are imperfect, but they will hopefully
>> pick up a good number of the strings required in localization. If it's
>> missing some, of course, you can add your own entries to the po file.
>> Moreover, many strings in commands have yet to be _()'d... we'd
>> appreciate anyone who wants to pitch in and make some more commands
>> localizable as well.
All you have to do is wrap localizable strings in preview's or
execute's with _(). Since moving to po _() doesn't support
replacements via printf format, you can simply leave ${variables} in
the strings and run the result through RenderTemplate, if need be.
I recommend leaving as much formatting as possible out of the
individual strings to localize. For example, if your string is
something like "<p>Here's a paragraph.</p><p>Here's another.</p>",
then it would be best if you put it as "<p>"+_("Here's a paragraph") +"</p><p>"+_('Here's another.')+"</p>". A little messy, perhaps, but
it will make localizations much cleaner and more straightforward.
> What do I need to do to make strings _() able? Can you point me at
> some documentation or examples for that? I am currently going through
> all the standard feeds renaming commands for the Overlord Verbs
> standard, so I might as well _() ify them at the same time, once I
> know how.
> --Jono
> On Mon, Jun 15, 2009 at 6:54 PM, Blair McBride<unfocu...@gmail.com>
> wrote:
>> Impressive!
>> - Blair
>> On 16/06/09 3:23 AM, "mitcho (Michael 芳貴 Erlewine)" wrote:
>>> Hi all,
>>> I just wanted to let the i18n group know that I today implemented
>>> localization with po (gettext portable object) files. Based on a
>>> number of comments I received in the past week, including a few from
>>> our very knowledgeable l10n team at Mozilla, I decided to at least
>>> give the po a stab. It turns out that using the jsgettext library (http://developer.berlios.de/projects/jsgettext/ >>> ) I could get it working in less than a day. This change will open
>>> Ubiquity command localization up to the vast resources and tools of
>>> the po world.
>>> One particular advantage of po is that it is a truly bilingual
>>> format,
>>> so the source text can be right there as a reference. There are no
>>> particular format restrictions on the keys (message ID's, or msgid),
>>> as opposed to properties files. There also is a message context
>>> (msgctxt) property which helps keep the msgid's less cluttered.
>>> Here's
>>> an example entry from firefox.ja.po which I was using to test:
>>> msgctxt "zoom.preview"
>>> msgid "Zooms the Firefox window to ${replacement} of its normal
>>> size."
>>> msgstr "ウインドウを通常の${replacement}のサイズで表
>>> 示。"
>>> So here's the string "Zooms the Firefox window to ${replacement} of
>>> its normal size." in the context of the preview() of the zoom
>>> command,
>>> and its Japanese equivalent. Properties (like names) don't take
>>> contexts and look like this:
>>> I also updated the localization template tool to produce po- >>> formatted
>>> templates (often called .pot). You can go to the command list and
>>> click on a feed's "get localization template" link to get the
>>> template. The localization template tool's recognition of _()'d
>>> strings in preview and execute are imperfect, but they will
>>> hopefully
>>> pick up a good number of the strings required in localization. If
>>> it's
>>> missing some, of course, you can add your own entries to the po
>>> file.
>>> Moreover, many strings in commands have yet to be _()'d... we'd
>>> appreciate anyone who wants to pitch in and make some more commands
>>> localizable as well.
> All you have to do is wrap localizable strings in preview's or
> execute's with _(). Since moving to po _() doesn't support
> replacements via printf format, you can simply leave ${variables} in
> the strings and run the result through RenderTemplate, if need be.
> I recommend leaving as much formatting as possible out of the
> individual strings to localize. For example, if your string is
> something like "<p>Here's a paragraph.</p><p>Here's another.</p>",
> then it would be best if you put it as "<p>"+_("Here's a paragraph")
> +"</p><p>"+_('Here's another.')+"</p>". A little messy, perhaps, but
> it will make localizations much cleaner and more straightforward.
> mitcho
>> Great work, Mitcho!
>> What do I need to do to make strings _() able? Can you point me at
>> some documentation or examples for that? I am currently going through
>> all the standard feeds renaming commands for the Overlord Verbs
>> standard, so I might as well _() ify them at the same time, once I
>> know how.
>> --Jono
>> On Mon, Jun 15, 2009 at 6:54 PM, Blair McBride<unfocu...@gmail.com>
>> wrote:
>>> Impressive!
>>> - Blair
>>> On 16/06/09 3:23 AM, "mitcho (Michael 芳貴 Erlewine)" wrote:
>>>> Hi all,
>>>> I just wanted to let the i18n group know that I today implemented
>>>> localization with po (gettext portable object) files. Based on a
>>>> number of comments I received in the past week, including a few from
>>>> our very knowledgeable l10n team at Mozilla, I decided to at least
>>>> give the po a stab. It turns out that using the jsgettext library (http://developer.berlios.de/projects/jsgettext/ >>>> ) I could get it working in less than a day. This change will open
>>>> Ubiquity command localization up to the vast resources and tools of
>>>> the po world.
>>>> One particular advantage of po is that it is a truly bilingual
>>>> format,
>>>> so the source text can be right there as a reference. There are no
>>>> particular format restrictions on the keys (message ID's, or msgid),
>>>> as opposed to properties files. There also is a message context
>>>> (msgctxt) property which helps keep the msgid's less cluttered.
>>>> Here's
>>>> an example entry from firefox.ja.po which I was using to test:
>>>> msgctxt "zoom.preview"
>>>> msgid "Zooms the Firefox window to ${replacement} of its normal
>>>> size."
>>>> msgstr "ウインドウを通常の${replacement}のサイズで表
>>>> 示。"
>>>> So here's the string "Zooms the Firefox window to ${replacement} of
>>>> its normal size." in the context of the preview() of the zoom
>>>> command,
>>>> and its Japanese equivalent. Properties (like names) don't take
>>>> contexts and look like this:
>>>> I also updated the localization template tool to produce po-
>>>> formatted
>>>> templates (often called .pot). You can go to the command list and
>>>> click on a feed's "get localization template" link to get the
>>>> template. The localization template tool's recognition of _()'d
>>>> strings in preview and execute are imperfect, but they will
>>>> hopefully
>>>> pick up a good number of the strings required in localization. If
>>>> it's
>>>> missing some, of course, you can add your own entries to the po
>>>> file.
>>>> Moreover, many strings in commands have yet to be _()'d... we'd
>>>> appreciate anyone who wants to pitch in and make some more commands
>>>> localizable as well.
>> All you have to do is wrap localizable strings in preview's or
>> execute's with _(). Since moving to po _() doesn't support
>> replacements via printf format, you can simply leave ${variables} in
>> the strings and run the result through RenderTemplate, if need be.
>> I recommend leaving as much formatting as possible out of the
>> individual strings to localize. For example, if your string is
>> something like "<p>Here's a paragraph.</p><p>Here's another.</p>",
>> then it would be best if you put it as "<p>"+_("Here's a paragraph")
>> +"</p><p>"+_('Here's another.')+"</p>". A little messy, perhaps, but
>> it will make localizations much cleaner and more straightforward.
>> mitcho
>>> Great work, Mitcho!
>>> What do I need to do to make strings _() able? Can you point me at
>>> some documentation or examples for that? I am currently going
>>> through
>>> all the standard feeds renaming commands for the Overlord Verbs
>>> standard, so I might as well _() ify them at the same time, once I
>>> know how.
>>> --Jono
>>> On Mon, Jun 15, 2009 at 6:54 PM, Blair McBride<unfocu...@gmail.com>
>>> wrote:
>>>> Impressive!
>>>> - Blair
>>>> On 16/06/09 3:23 AM, "mitcho (Michael 芳貴 Erlewine)" wrote:
>>>>> Hi all,
>>>>> I just wanted to let the i18n group know that I today implemented
>>>>> localization with po (gettext portable object) files. Based on a
>>>>> number of comments I received in the past week, including a few
>>>>> from
>>>>> our very knowledgeable l10n team at Mozilla, I decided to at least
>>>>> give the po a stab. It turns out that using the jsgettext
>>>>> library (http://developer.berlios.de/projects/jsgettext/ >>>>> ) I could get it working in less than a day. This change will open
>>>>> Ubiquity command localization up to the vast resources and tools
>>>>> of
>>>>> the po world.
>>>>> One particular advantage of po is that it is a truly bilingual
>>>>> format,
>>>>> so the source text can be right there as a reference. There are no
>>>>> particular format restrictions on the keys (message ID's, or
>>>>> msgid),
>>>>> as opposed to properties files. There also is a message context
>>>>> (msgctxt) property which helps keep the msgid's less cluttered.
>>>>> Here's
>>>>> an example entry from firefox.ja.po which I was using to test:
>>>>> msgctxt "zoom.preview"
>>>>> msgid "Zooms the Firefox window to ${replacement} of its normal
>>>>> size."
>>>>> msgstr "ウインドウを通常の${replacement}のサイズで表
>>>>> 示。"
>>>>> So here's the string "Zooms the Firefox window to ${replacement}
>>>>> of
>>>>> its normal size." in the context of the preview() of the zoom
>>>>> command,
>>>>> and its Japanese equivalent. Properties (like names) don't take
>>>>> contexts and look like this:
>>>>> I also updated the localization template tool to produce po-
>>>>> formatted
>>>>> templates (often called .pot). You can go to the command list and
>>>>> click on a feed's "get localization template" link to get the
>>>>> template. The localization template tool's recognition of _()'d
>>>>> strings in preview and execute are imperfect, but they will
>>>>> hopefully
>>>>> pick up a good number of the strings required in localization. If
>>>>> it's
>>>>> missing some, of course, you can add your own entries to the po
>>>>> file.
>>>>> Moreover, many strings in commands have yet to be _()'d... we'd
>>>>> appreciate anyone who wants to pitch in and make some more
>>>>> commands
>>>>> localizable as well.