Page MenuHomePhabricator

Fix broken sentences in translation strings
Closed, ResolvedPublic

Description

Many of the translations have been split up to avoid including HTML in the string. This means that some of the sentences can't be translated to other languages as the word order can't be changed.

  • Merge broken sentences into single strings
  • Replace attributes for links within strings with link_attrs variables
  • Extract all final messages from JS and new merged strings
  • Reconcile merged strings with existing translations in the .po file

Note: For convenience, all JavaScript compilation files have been committed. So you just need to run the pybabel compile -d translations command from the isa subfolder to create the .mo and everything should work

Example

e.g.

<p>
  <strong>ISA</strong> {{ _( 'is a fun, multilingual, mobile-first tool, that makes it easy for people 
  to add "micro contributions" in the form of') }} 
  <a  href="https://commons.wikimedia.org/wiki/Commons:Structured_data" target="_blank"> {{ _('structured data') }} </a> 
  {{ _('to images on  Wikimedia Commons that have been added by Wiki Loves competitions.') }}**
</p>

Instead, we need to include the whole sentence, including the HTML within the string so translators can determine the word order.

The HTML included will generally just be <strong> or <a> tags.

In order to make sentences with <a> tags more readable, we should ideally insert all of the attributes (href, target, classes, ids etc) as a variable in the string.

So the translate file reads:

Some text etc <a %{link_attrs}s> link text </a>

where link_attrs could be e.g. href=https://commons.wikimedia.org/wiki/Commons:Structured_data target="_blank"

Event Timeline

Change 536736 had a related patch set uploaded (by NavinoEvans; owner: NavinoEvans):
[labs/tools/Isa@master] Fix broken sentences in translation strings

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

Change 536736 merged by jenkins-bot:
[labs/tools/Isa@master] Fix broken sentences in translation strings

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