Translate grd files

723 views
Skip to first unread message

Georgy Buranov

unread,
May 27, 2015, 10:09:48 AM5/27/15
to chromi...@chromium.org
Hi everybody.
I raised some time ago topic about translations, and people helped me a lot here.

I want to raise a topic now - how to create translation for these grd files.
The https://www.chromium.org/developers/design-documents/ui-localization article just says that there are translation (xtb) files but does not mention HOW to create them.

Is there some tool for it?

Anton Vayvod

unread,
May 27, 2015, 10:42:53 AM5/27/15
to gbur...@gmail.com, chromium-dev
There's an internal tool that Google uses to translate the messages from the .xmb file created by GRIT and generate the .xtb files for Google Chrome. The .xtb files are dumped into the Chromium tree every now and then, typically before the release branch point so new strings must be checked in before that.

If you're contributing to Chromium, the strings will be translated automatically when the new .xtb files are generated and checked into the repo.
If you're building your own browser, I believe generating the translations (at least for your own strings) is your burden. See [1] for more info:

"Its formats for this are the .xmb format (generated by the grit xmb tool) and the .xtb format (referenced by the <translation> node in the .grd file). These are very basic formats that contain the messages, with placeholders and with any descriptions provided to give the translators context. The assumption is that there is some other system that reads the .xmb format, provides translators with another format or a UI that lets them translate more easily, then takes what it receives back from translators and packages it back up into the .xtb format."

Hopefully other Chromium-based browser vendors could chime in with more helpful info (e.g. I didn't find .xtb file format definition in public by a quick search but think it's very similar to the generated .xmb file).


--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

George Buranov

unread,
May 27, 2015, 10:55:19 AM5/27/15
to ava...@chromium.org, chromium-dev
We are building our own browser.


What is the main reason for the translation tool to be internal?

Regards,
Georgy

Dominic Mazzoni

unread,
May 27, 2015, 11:20:57 AM5/27/15
to gbur...@gmail.com, Anton Vayvod, chromium-dev
It uses the same system that Google uses to translate all of its other products, which is a proprietary system internal to Google.

For Chromium, the source files and the final translations are all public, but the intermediate steps are not, and if you want to do your own translations you'll have to come up with your own workflow.

Newton Allen

unread,
May 27, 2015, 12:46:35 PM5/27/15
to gbur...@gmail.com, ava...@chromium.org, chromium-dev
The XTB format is pretty simple: one line per translation, with the contents of placeholders replaced with a self-closing <ph> tag. I'd just look at one of the xtb files in Chromium and the format should be clear. The only mysterious part is what ID to use for each string. The ID can be generated using grit: take a look at GenerateId() in tools/grit/grit/tclib.py.

On Wed, May 27, 2015 at 7:54 AM, George Buranov <gbur...@gmail.com> wrote:

Rouslan Solomakhin

unread,
May 27, 2015, 1:21:48 PM5/27/15
to ne...@chromium.org, gbur...@gmail.com, ava...@chromium.org, chromium-dev
GRIT generates IDs in the range from decimal 101 to 0x7FFF in order to work with Windows. See https://code.google.com/p/grit-i18n/source/browse/trunk/grit/format/rc_header.py?r=94#169 and http://msdn.microsoft.com/en-us/library/t2zechd4(VS.71).aspx. Note that Chromium offsets the IDs in different GRD files to avoid ID collisions. See https://code.google.com/p/chromium/codesearch#chromium/src/chrome/tools/build/repack_locales.py.
Reply all
Reply to author
Forward
0 new messages