New feature: merge or overwrite your language files

By Edouard on April 26, 2010

When you update a language file on Web Translate It, you will notice two new options:

  • Overwrite existing strings,
  • Flag missing keys as obsolete.

What does it mean?

These options control the importer’s behaviour when uploading a new language file. These are advanced options and you should only use them if you know what you are doing.

Overwrite existing strings

Let’s consider you have a project in which the source language is English, to translate into French and Italian. The project has these 2 strings already in Web Translate It’s database.

greetings: "hllo {{user}}"
welcome: "Wellcome"

These strings have been written by your developers, contain spelling mistakes, and are considered as placeholders. You want to update these strings from the web interface, so you just add the English language to Web Translate It, and edit these strings directly. Job done! You now have:

greetings: "hello {{user}}"
welcome: "Welcome"

That’s more like it.

Now bad news: the developer has decided to update his language file, which add one more string. The importer does a complete sync and therefore, overwrite your changes and flag all the existing translations as “to verify”. The strings in database are now:

greetings: "hllo {{user}}"
welcome: "Wellcome"
sorry: "Im not so good in Engrish"

So basically all your good work went to waste! Something is wrong, what can you do? The new overwrite option will help you with this problem.

Let’s go back to step 2 where you had:

greetings: "hello {{user}}"
welcome: "Welcome"

Now the developer upload a new language file containing the new additional string, and untick the checkbox “Overwrite existing strings”. Before doing any update, Web Translate It will now check whether this string already exist in database or not. If the string exist, WTI won’t alter it and therefore your changes are safe. You’ll now have in database your nice changes, plus a new string to proofread:

greetings: "hello {{user}}"
welcome: "Welcome"
sorry: "Im not so good in Engrish"

And you can fix the last string from the web interface:

greetings: "hello {{user}}"
welcome: "Welcome"
sorry: "I’m certainly not so good in English, but others can proofread!"

This will be really useful for you if your workflow include proofreading the source string.

Flag missing keys as obsolete

This second option is more straightforward. Let’s consider the same project than above. You have these strings in database:

greetings: "hello {{user}}"
welcome: "Welcome"
sorry: "I’m certainly not so good in English, but others can proofread!"

Now, the developer upload a file containing:

greetings: "hello {{user}}"
welcome: "Welcome"
funny_joke: "This last string should be replaced by a funny joke by the proofreader"

By default, the importer will flag the string “sorry” as “obsolete”, because it has been removed from the file and should not be translated. Additionaly, the new string “funny_joke” has been added.

But what if you never want to remove strings? You now can, by unticking this box. Instead of the above you would have get:

greetings: "hello {{user}}"
welcome: "Welcome"
sorry: "I’m certainly not so good in English, but others can proofread!"
funny_joke: "This last string should be replaced by a funny joke by the proofreader"

These two options can be combined, so it covers pretty much any kind of workflow. This is a very powerful feature.

API

This feature is accessible via the web interface, and also the Update File API endpoint. Optional parameters can now be passed:

  • merge=true, to disable overwriting strings (default is false)
  • ignore_missing=true, to disable obsoleting strings (default is false).

If you use the API without these parameters the importers will overwrite and obsolete strings as usual.

Web Translate It gem

The web_translate_it gem has been updated and the new version 1.6.6 now propose 2 new options:

  • --merge to force WTI to perform a merge of this file with its database.
  • --ignore_missing to force WTI to not obsolete missing strings.

You can use these options this way:

$ wti push --merge
$ wti push --ignore_missing

Or you can also combine them:

$ wti push --merge --ignore_missing

To update the web_translate_it rubygem to the latest version: gem install web_translate_it.

I hope you will find this feature useful. Web Translate It can now adapt to pretty much any kind of translation workflow!