Weblate: How to add new translation key using weblate?

Created on 7 Jun 2016  路  20Comments  路  Source: WeblateOrg/weblate


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

enhancement hosted

Most helpful comment

As a prospective user looking at the online demo, I became quite frustrated trying to figure out how to add new key. I am new to translation tools so I could be missing something but Weblate seems so close to letting developers transcend having to maintain each individual language file repetitively. Given enough time, manual updates cause message files get out of order, developer forgets to add/rename/remove a key from one language. Any reason not to have an "add key" button that adds a specified key to all languages and defaults value to machine translation unverified?

All 20 comments

You need to add it to the translation files in git. This is usually managed by developers, not by translators. See also https://docs.weblate.org/en/latest/faq.html#does-weblate-update-translation-files-besides-translations

Ok, then I have a feature request. Its not handy to add it manually to translation files(at least I have to check for duplicates). Would be great to have it!

So far this have been considered out of scope for Weblate, but it seems that it makes some sense for monolingual translations...

As a prospective user looking at the online demo, I became quite frustrated trying to figure out how to add new key. I am new to translation tools so I could be missing something but Weblate seems so close to letting developers transcend having to maintain each individual language file repetitively. Given enough time, manual updates cause message files get out of order, developer forgets to add/rename/remove a key from one language. Any reason not to have an "add key" button that adds a specified key to all languages and defaults value to machine translation unverified?

The translation keys are usually managed by tools which keep them in sync with the code (eg. xgettext/msgmerge), so there is no need to do that manually.

So the approach we've taken unfortunately means the likes of xgettext/msgmerge aren't really an option for us.

From our .po files we generate a static struct of translation keys. This means, when performing string lookups in code no only do we get autocomplete on key names but if someone removes a key (which is being used still) then the project will fail on compile. Other benefits include guarding against typos and warnings over unused strings in the project. For these reasons I really like the approach we've taken.

The problem is that we're generating our struct of keys from the .po files, instead of going the other way and generating keys from code (with a tool such as xgettext). Whilst there's benefits of both ways I can see far more with the approach we've taken. It does mean however that the process of adding new keys has to be done at the .po level and then Weblate updated through a git pull. It would be far better if we could add new keys through the Weblate interface as this would mean the process of adding new source strings could be shared, instead of it being just a dev task.

It probably makes sense to implement this for monolingual formats, but it IMHO doesn't make sense for bilingual formats where the source strings are usually extracted from the source code, thus something clearly out of Weblate control.

Agreed. I think it would be a great Weblate addition for setups using monolingual formats.

+1 we defnitly need it. It's not because we are developer that we don't like to have a GUI if it bring something.

In this case I see clearly a good advantage of the GUI: the developer can add the key without get worried if it is already exists because weblate could check for this.

Would a pull request get refused if it add this feature ?

Thank you for your report, the issue you have reported has just been fixed.

  • In case you see problem with the fix, please comment on this issue.
  • In case you see similar problem, please open separate issue.
  • If you are happy with the outcome, consider supporting Weblate by donating.

hello @nijel , we did update our weblate version to 2.20 in order to allow our translators to use this feature but I didn't find any reference on weblate documentation about how to add new units in a xliff project.
Could you help me?

It's in Tools menu for source language:

screenshot_2019-02-25 getback gps strings - english

@nijel thanks but it seems I don't have that option.
Obviously I am administrator, with all the permission set.
Any idea?

image

image

As written above you can do it on source language only and it works only on monolingual translations.

@nijel actually even with the source language (it should be english by default), I cannot add units from the tools menu.
Do you think I am missing something?

image

It really depends on your monolingual setup. I'm not sure when it was changed, but for quite some time the source language is highlighted on both listing and detail.

Worked like a charms with your explainations @nijel thank you very much! a small more information for new users: you can't reach this from the project it self. You have first to click on a component of the project.

@nijel Will this also be available as an API call?

@jornvl90 I've created https://github.com/WeblateOrg/weblate/issues/3261 to track this.

Please discuss this at https://github.com/WeblateOrg/weblate/issues/3261 and not here on a closed issue, thanks.

Was this page helpful?
0 / 5 - 0 ratings