Make WordPress Core

Opened 9 years ago

Closed 9 years ago

#31862 closed defect (bug) (fixed)

Avoid using HTML tags in translation strings and add context

Reported by: ramiy's profile ramiy Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: I18N Keywords: has-patch
Focuses: Cc:

Description

Currenly we have four translation strings in wp-admin/plugin-editor.php using <strong> & </strong> tags.

I've moved the HTML tags outside of the main string, and added context using _x() function.

Before:

  • Editing <strong>%s</strong> (active)
  • Browsing <strong>%s</strong> (active)
  • Editing <strong>%s</strong> (inactive)
  • Browsing <strong>%s</strong> (inactive)

After:

  • Editing %s
  • Browsing %s
  • (active)
  • (inactive)

Now those are simpler strings, and more important - they are easier to translate.

I hope that in the future we will have more translator-friendly-strings!

Attachments (2)

31862.patch (1.1 KB) - added by ramiy 9 years ago.
34341.2.patch (1.1 KB) - added by ramiy 9 years ago.

Download all attachments as: .zip

Change History (16)

@ramiy
9 years ago

#1 @ramiy
9 years ago

  • Keywords has-patch added

#2 @DrewAPicture
9 years ago

  • Version trunk deleted

This ticket was mentioned in Slack in #polyglots by ramiy. View the logs.


9 years ago

#4 @wonderboymusic
9 years ago

  • Milestone changed from Awaiting Review to 4.4
  • Owner set to SergeyBiryukov
  • Status changed from new to assigned

#5 @wonderboymusic
9 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 34341:

Plugin Editor: Avoid using HTML tags in translation strings and add context.

Props ramiy.
Fixes #31862.

#6 @pavelevap
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

I do not think this is a good change... Translators comments are missing and translators are also limited now. I could make translation for example like this: Editing <strong>%s</strong> - active or Active plugin: <strong>%s</strong>. Why are we using _x() here? Removing HTML is OK, but splitting not. Editing %s (active) would be good enough?

@ramiy
9 years ago

#7 @ramiy
9 years ago

The new patch has translation strings.

#8 @wonderboymusic
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 34469:

After [34341], add translation strings.

Props ramiy.
Fixes #31862.

#9 @pavelevap
9 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

There are still problems:

  • Context _x() is not needed here.
  • Splitting strings is not good in this case.

#10 @ocean90
9 years ago

I don't think that splitting the (in)active part is an issue here.

Current translations:

an | Editando <strong>%s</strong> (activo)
ar | تحرير <strong>%s</strong> (مفعّلة)
ary | تحرير <strong>%s</strong> (مفعّلة)
az | <strong>%s</strong> redaktə edilir (aktiv)
bg | Редактиране на <strong>%s</strong> (включено)
bn | <strong>%s</strong> সম্পাদনা (সক্রিয়)
bs | Uređivanje <strong>%s</strong> (aktivno)
ca | Esteu editant <strong>%s</strong> (actiu)
ckb | دهستکاریکردنی <strong>%s</strong> (چالاکه)
cs | Upravujete soubor <strong>%s</strong> (aktivní plugin)
cy | Golygu <strong>%s</strong> (gweithredol)
da | Redigerer <strong>%s</strong> (aktiv)
de | Bearbeite <strong>%s</strong> (aktiv)
de | Bearbeite <strong>%s</strong> (aktiv)
de-ch | Bearbeite <strong>%s</strong> (aktiv)
el | Γίνεται επεξεργασία του <strong>%s</strong> (ενεργό)
en-au | Editing <strong>%s</strong> (active)
en-ca | Editing <strong>%s</strong> (active)
en-gb | Editing <strong>%s</strong> (active)
en-nz | Editing <strong>%s</strong> (active)
eo | Redaktas <strong>%s</strong> (aktive)
es | Editando <strong>%s</strong> (activo)
es-cl | Editando <strong>%s</strong> (activo)
es-mx | Editando <strong>%s</strong> (activo)
es-pe | Editando <strong>%s</strong> (activo)
es-ve | Editando <strong>%s</strong> (activo)
et | Muudan pluginat <strong>%s</strong> (sisselülitatud)
eu | <strong>%s</strong> editatzen (gaitua)
fa | در حال ویرایش <strong>%s</strong> (فعال)
fi | Muokattavana: <strong>%s</strong> (käytössä)
fo | Broyting av <strong>%s</strong>
fr | Modification de <strong>%s</strong> (activé)
fr-be | Modification de <strong>%s</strong> (activé)
fr-ca | Modification de <strong>%s</strong> (activé)
fy | Bewurkje <strong>%s</strong>(aktyf)
gd | A' deasachadh <strong>%s</strong> (ann an gnìomh)
gl | Editando <strong>%s</strong> (activo)
gsw | Bearbeite <strong>%s</strong> (aktiv)
gsw | Bearbeite <strong>%s</strong> (aktiv)
haz | در حال ادیت <strong>%s</strong> (فعال)
he | עריכת הקובץ <strong>%s</strong> (בשימוש כרגע)
hi | <strong>%s</strong> का सम्पादन किया जा रहा है (सक्रिय)
hr | Uređivanje <strong>%s</strong> (aktivan)
hu | <strong>%s</strong> módosítása (bekapcsolva)
hy | <strong>%s</strong>-ի խմբագրում (գործուն)
id | Menyunting <strong>%s</strong> (aktif)
is | Breyti <strong>%s</strong> (virk)
it | Modificando <strong>%s</strong> (attivo)
ja | <strong>%s</strong> の編集 (使用中)
jv | Dandani <strong>%s</strong> (aktif)
ka | ასწორებთ <strong>%s</strong> (აქტიური)
kab | Abeddel n <strong>%s</strong> (yermed)
kk | Өңделуде: <strong>%s</strong> (белсенді)
km | កំពុងកែ <strong>%s</strong> (ដែលសកម្ម)
ko | <strong>%s</strong> 편집 (활성화)
lo | ກຳລັງແກ້ໄຂ <strong>%s</strong> (active)
lt | <strong>%s</strong> redagavimas (įjungtas)
lv | Labojam <strong>%s</strong> (aktīvs)
me | Uređivanje <strong>%s</strong> (aktivno)
mk | Уредувам <strong>%s</strong> (активно)
mn | <strong>%s</strong>-г засварлаж байна (идэвхтэй)
ms | Menyunting <strong>%s</strong> (aktif)
mya | <strong>%s</strong>အား ပြုပြင်နေသည်။ (အလုပ်လုပ်ဆောင်နေသည်။)
nb | Redigerer <strong>%s</strong> (aktiv)
nl | Bewerken <strong>%s</strong>(actief)
nn | Endring av <strong>%s</strong> (verksamt)
oci | Modificacion de <strong>%s</strong> (activat)
pl | Edycja <strong>%s</strong> (wtyczka jest włączona)
ps | سموي <strong>%s</strong> (فعال)
pt | A editar <strong>%s</strong> (activo)
pt | A editar <strong>%s</strong> (activo)
pt-br | Editando <strong>%s</strong> (ativo)
ro | Editare <strong>%s</strong> (activ)
ru | Редактирование <strong>%s</strong> (активен)
si | <strong>%s</strong> (සක්රිය) සංස්කරණ කරමින්
sk | Editovanie <strong>%s</strong> (aktívne)
sl | Urejanje <strong>%s</strong> (aktivno)
sq | Përpunim i <strong>%s</strong> (veprues)
sr | Уређивање <strong>%s</strong> (укључен)
su | Ngaropéa <strong>%s</strong> (hirup)
sv | Redigerar <strong>%s</strong> (aktiv)
sw | Anahariri <strong>%s</strong> (changamka)
ta-lk | <strong>%s</strong> தொகுக்கப்படுகின்றது (தற்போது)
th | กำลังแก้ไข <strong>%s</strong> (active)
tl | Nagbabago ng <strong>%s</strong> (aktibo)
tr | <strong>%s</strong> düzenleniyor (etkin)
ug | <strong>%s</strong> تەھرىرلىنىۋاتىدۇ (ئاكتىپ)
uk | Редагування <strong>%s</strong> (активне)
uz | Редактирование <strong>%s</strong> (активен)
vi | Chỉnh sửa <strong>%s</strong> (bật)
zh-cn | 编辑<strong>%s</strong>(已启用)
zh-tw | 編輯 <strong>%s</strong>(啟用)

#11 follow-up: @pavelevap
9 years ago

Translators should view the whole string, because they can also see better context.

(active) - What is active? Where is it diplayed? At least there is a need for detailed translators comment, because it does not mean only "active plugin", but context is "editing file in plugin editor for active plugin and active word in brackets has to be in the end of sentence". This is not a good approach...

See: https://make.wordpress.org/polyglots/2015/09/14/feature-request-letting-translator-know-where-the-string/

Editing %s (active) - translators can see where is "(active)" located, they can see better context.

What is the point of splitting those strings? Number of strings is same in the end and we are only making translators life harder.

#12 in reply to: ↑ 11 @ramiy
9 years ago

Replying to pavelevap:

Translators should view the whole string, because they can also see better context.

(active) - What is active? Where is it diplayed? At least there is a need for detailed translators comment, because it does not mean only "active plugin", but context is "editing file in plugin editor for active plugin and active word in brackets has to be in the end of sentence". This is not a good approach...

What active? the plugin is active.

This is why we used the _x() function.

We added content to the string.

The code is _x( '(active)', 'plugin' );

#13 @pavelevap
9 years ago

_x() functions should not be used here. It is the place for translators comment with detailed explanation like "String is diplayed when editing file in plugin editor for active plugin and this word in brackets has to be in the end of the whole sentence above editor". Simple context "plugin" can mean many things in different languages: is it one plugin active or more, is it adjective or verb, where can be seen this string, etc. We know it very well, but many translators not...

#14 @SergeyBiryukov
9 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

In 34547:

Plugin Editor: Don't split the strings with plugin file name and remove unnecessary context.

Partially reverts [34341].

Fixes #31862.

Note: See TracTickets for help on using tickets.