Page MenuHomePhabricator

Add support for ISA in translatewiki.net
Closed, ResolvedPublicFeature

Description

Setup using https://translatewiki.net/ so that anyone can contribute translations of the User Interface into any language.
For the first version of the app we will have text completed for English and French options.

Some of the main concerns which are relevant for the project are:

Content fit:

  • Software interface messages.
  • Takes some prose which will be split into smaller parts.
  • The tool is for the use of the general public.

License:

  • GPLv2

Quality of strings

Link to code repository here

  • Localisation files are located at isa/translations/<language_code>/LC_MESSAGES/messages.po

Activity and interest (releases, contact person)

Project setup checklist

Project information

Name: ISA
Logo:

  • Optional, SVG format recommended. Add filename in commons or translatewiki.net

Project description: This tool helps to describe the images contributed to Wiki Loves competitions.
Project page:

Project configuration (for translation admins)

Namespace: NS_WIKIMEDIA (WikimediaTools)
Prefix: isa-*
Validators:

  • PythonInterpolation
  • HtmlTagInsertablesSuggester

Related Objects

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes

@Nikerabbit the i18n files have been created in [T224407]. Please can you provide more insight on the code which is required to read and display the messages from these files?

There is no simple answer to that. Depending on the programming language you use, you might find existing i18n library you can use, but it might not support the json format out of the box. The other option is to build one yourself. It's quite easy to build a simple one, but you will lack in features such as fallbacks and plurals.

@Nikerabbit after T224675 we are able to mark strings in ISA for translation, generate the translation .po files with these strings ready for translations in other languages, compile and load the translations on the interface.

Are there any next steps to carry-out so that we can mark ISA for translation?

Spinster added a subscriber: Spinster.

Can perhaps anyone help with this in the context of the Wiki-Techstorm-2019 ? I know that we have some people here today and tomorrow, interested in translating the ISA interface in other languages.

What steps still need to be taken in order to make this work? Pinging @Nikerabbit, @Eugene233 and @NavinoEvans

Could you update the task description to add link to the code repository and mention where the localisation files are there?

@Nikerabbit I have updated the description as required.

Eugene233 updated the task description. (Show Details)
siebrand renamed this task from Add User Interface language options using TranslateWiki service to Add support for ISA in translatewiki.net.Jan 2 2020, 5:02 PM

This issue is not ONLY an interface issue. That tool was intended to be multilingual, because this is one of the benefit of using Wikidata (being language neutral).
At the moment, depicts can only be added in French and in English. No other language. So, whilst the tool was meant to be language neutral, it is actually restricted to two languages for its most part.

@Nikerabbit I'm wondering if we're good to go on this one, or is any action still needed from our side?

I cannot confirm license. Task description says GPL-2.0, package.json GPL-3.0, but there is no LICENSE or COPYING file in the repository.

I cannot confirm file format(s).

There is i18n/en.json, which seems to be a stub for MediaWiki extensions. Is it used by isa somewhere?

Then there is messages.pot in the repository root, but it has invalid syntax: https://gerrit.wikimedia.org/r/plugins/gitiles/labs/tools/Isa/+/refs/heads/master/isa/messages.pot#11

There is translations/<CODE>, for fr there messages.po (looks ok) and messages.json (what is this for) and for ml there is what looks to be empty messages.po (delete if nothing there?).

Thanks very much for your comment @Nikerabbit

i18n/en.json is an experiment file for the translation string implementation which could likely be removed( might not be useful at the moment)

messages.pot is the index file which we use to build the locals 'fr', 'ml' and others (similar to the stub for MediaWiki extensions) found in the translation directory (translations/fr and translations/ml for example)

In a nutshell, we get translation strings from files translations/<CODE>. So we use messages.pot to build locals for new languages we intend to add ( such as 'ml' )

Hi @Nikerabbit, we've just deployed some changes to the i18n setup, and cleaned up old unused things from the previous setup: T265795: Move client side translations to the server

With this change, the process for updating translations or adding new supported languages has been greatly simplified. All of the instructions have been added to the project README file, but I've also pasted them in below. Steps 3b, 4 and 5 seem to be the ones that you will need to use.
Let me know what further changes are needed? I'm guessing you may need API calls setup up for updating translations and adding new supported languages? Happy to have to organise an online chat if helpful!

Managing Translations (copied from ISA README)

Steps 1 to 3a below show how to extract and generate translation files from the
source code.

Start from step 3b if you are *only* adding a new supported language for the app.

Start from step 4 if you are *only* adding translated text for already supported
languages.

Skip directly to step 5 if you have pulled changes which include updated
translations (edited .po files).

All commands should be run from the /isa subfolder.

1. Add or edit translatable text in source code

Mark new strings to be translated using formats shown below:

  • Templates: _('<string>')
  • Python: gettext('<string>')

2. Extract strings to .pot file

pybabel extract -F babel.cfg -o messages.pot --input-dirs=.

This step is only needed after changes have been made to translatable text
in the source code in step 1.

3a. Update .po files

pybabel update -i messages.pot -d translations -l <lang_code>

Use this command to update .po files for each supported language.

It will merge in any new strings found in the .pot file generated in step 2.
Any strings that are no longer found are placed at the bottom of the file, using
commented out lines beginning with #~

3b. Create new .po file

pybabel init -i messages.pot -d translations -l <lang_code>

Use this command to create a *new* .po file.

This step is only needed when adding a new supported language.
Commit the new .po file to source control.

4. Add new translations

Add the actual translated text for each language to the corresponding .po file
located at:

isa/translations/<lang_code>/LC_MESSAGES/messages.po

This step should be completed by translators, so can happen at any time.
Commit any changes to .po files to source control.

5. Compile final .mo file

pybabel compile -d translations

Once translations are ready from step 4 (or from pulling changes with
updated .po files), you need run the compile command before seeing the new
translations in the app.

@NavinoEvans , thanks for your detailed response. Please note that the generation of the machine object file will have to be done on your end. Translatewiki.net will not do that.

At a first glance, the setup looks good, I'll start integrating the project to translatewiki this week.

abi_ added a subscriber: Eugene.

@NavinoEvans / @Eugene233 - Does the project have a logo that we can put on Translatewiki? Its not mandatory but good to have.

Change 744758 had a related patch set uploaded (by Abijeet Patro; author: Abijeet Patro):

[translatewiki@master] Add lab-tools-Isa

https://gerrit.wikimedia.org/r/744758

Change 744758 merged by jenkins-bot:

[translatewiki@master] Add lab-tools-Isa

https://gerrit.wikimedia.org/r/744758

That's amazing news! Thanks so much for all the help @abi_, you're a star :)

That's amazing news! Thanks so much for all the help @abi_, you're a star :)

Seconding this! THANK YOU SO MUCH! (I rarely use all caps but this is a good occasion.)

Macro tech-barnstar:

Gosh, I had missed the last info. Yoohooo !

Change 752658 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[integration/config@master] Add gate-and-submit-l10n to Isa

https://gerrit.wikimedia.org/r/752658

Change 752276 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[labs/tools/Isa@refs/meta/config] Review access change

https://gerrit.wikimedia.org/r/752276

The patches above should fix it, as far as I could understand from https://www.mediawiki.org/wiki/Gerrit/L10n-bot. Let me know if there's anything I missed.

Change 752658 merged by jenkins-bot:

[integration/config@master] Add gate-and-submit-l10n to Isa

https://gerrit.wikimedia.org/r/752658

Mentioned in SAL (#wikimedia-releng) [2022-01-10T14:01:15Z] <James_F> Zuul: Add gate-and-submit-l10n to Isa for T222291

We will check on Thursday after next automatic export (assuming there are translation updates).

Change 753059 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[translatewiki@master] Fix typo for ISA

https://gerrit.wikimedia.org/r/753059

Change 753059 merged by jenkins-bot:

[translatewiki@master] Fix typo for ISA

https://gerrit.wikimedia.org/r/753059

Change 753418 had a related patch set uploaded (by Sebastian Berlin (WMSE); author: Sebastian Berlin (WMSE)):

[labs/tools/Isa@master] Fix typo in translation path

https://gerrit.wikimedia.org/r/753418