Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#27069 closed defect (bug) (fixed)

Twenty Fourteen: Incorrect internationalization in Ephemera widget

Reported by: chouby's profile Chouby Owned by: lancewillett's profile lancewillett
Milestone: 3.9 Priority: normal
Severity: normal Version: 3.8
Component: Bundled Theme Keywords: has-patch
Focuses: Cc:

Description (last modified by SergeyBiryukov)

The string More %s <span class="meta-nav">&rarr;</span> does not allow accurate translations as it does not follow i18n best practices, which require to translate whole sentences. For example, in French, "More videos" is translated in "Plus de vidéos" and "More images" is translated in "Plus d'images". The translator is currently forced to translate the latest as "Plus de images" which is really ugly.

Moreover storing translatable strings in private variables (here $format_strings) is in my opinion not a good idea (as it prevents some multilingual plugins to translate these strings). So it would be preferrable to make $format_strings either public or protected to avoid a complete rewrite of the widget.

Attachments (6)

27069.patch (1.4 KB) - added by SergeyBiryukov 10 years ago.
27069.2.patch (3.5 KB) - added by Chouby 10 years ago.
27069.2.2.patch (3.5 KB) - added by Chouby 10 years ago.
27069.3.patch (3.5 KB) - added by SergeyBiryukov 10 years ago.
27069.4.patch (3.5 KB) - added by lancewillett 10 years ago.
Cleaner switch statement with added default case
27069.5.patch (3.6 KB) - added by lancewillett 10 years ago.
Better translator context for the arrow

Download all attachments as: .zip

Change History (23)

#1 @SergeyBiryukov
10 years ago

  • Description modified (diff)
  • Summary changed from Twenty fourteen: incorrect internationalization in Ephemera widget to Twenty Fourteen: Incorrect internationalization in Ephemera widget

#2 @SergeyBiryukov
10 years ago

  • Keywords has-patch added

Yeah, we should avoid post type and taxonomy names in generic strings, as noted in ticket:17609:3 and ticket:19099:1.

#3 @pavelevap
10 years ago

I do not think that these are taxonomy names? For example string "Galleries" is related only to Twenty Fourteen, but there is another core string "Gallery" for related post format. I had no problems with it, I translated "Galeries" as "Galerie" and this string is used only for archives and "More" string. So "More ..." could be translated as only "Plus" and "Images" as "d'images" in Czech (only example). But I really do not know about French possibilities...

But in the end I do not like the idea of many new strings, what about only "More" or "More items"?

#4 @SergeyBiryukov
10 years ago

These are plural post format names (see also #23257).

The problem is that they are also used as standalone strings in the widget title:
tags/3.8.1/src/wp-content/themes/twentyfourteen/inc/widgets.php#L76

"More" seems fine to me.

#5 follow-ups: @pavelevap
10 years ago

Yes, I know about missing plural post format names, but this case is only related to Twenty Fourteen, so I took it as only special strings not related to any taxonomy. And I think that it is possible to translate them, even if with some more creativity :-) What about Russian, any problems?

You are right that post format plural names should not be used here. Even if there would be plural forms for post format names, it does not solve related problems definitely. Example: "Notes" - plural post format name, in Czech "Poznámky", but in sentence it can be also "Poznámek" in some circumstances (for example inflexion - accusative case).

Yes, I know about widget title, but it still works fine in Czech :-)

You patch is fine, it looks better when there is "More Videos" than only "More". But there are many new strings for this little feature...

#6 in reply to: ↑ 5 @Chouby
10 years ago

Replying to pavelevap:

But there are many new strings for this little feature...

For what reason do you think it's disturbing?

  • Additional translator work -> "More" would be the best solution to avoid this
  • Increased mo file size -> same as above
  • Performance issue due to more gettext calls -> We can decide to translate only the strings of the actual format in the widget function (will also decrease the number of translations in case the widget is used several time with different post formats as currently the private $format_strings array is translated for each widget).

#7 in reply to: ↑ 5 @SergeyBiryukov
10 years ago

Replying to pavelevap:

What about Russian, any problems?

We don't use capital letters in the middle of a sentence ("Другие Заметки" should be "Другие заметки"). It's currently impossible to change that, as "Заметки" is also used as a standalone string in the widget title (same for other formats).

Luckily, the problem isn't noticeable in Twenty Fourteen due to text-transform: uppercase :-)

@Chouby
10 years ago

#8 @Chouby
10 years ago

27069.2.patch illustrates what I meant above by

We can decide to translate only the strings of the actual format in the widget function

#9 @SergeyBiryukov
10 years ago

In 27069.2.patch, printf() should not be removed in line 211, otherwise $format_string_more is unused.

@Chouby
10 years ago

#10 @Chouby
10 years ago

Yes sure. I mixed myself as I initially implemented your proposal to use "More" only. I should also not remove the $format variable which is used outside the removed code. Both are fixed in 27069.2.2.patch.

#11 @SergeyBiryukov
10 years ago

27069.3.patch fixes a typo in 27069.2.2.patch ("More asides" vs. "More aside").

#12 @lancewillett
10 years ago

  • Milestone changed from Awaiting Review to 3.9

@lancewillett
10 years ago

Cleaner switch statement with added default case

This ticket was mentioned in IRC in #wordpress-themes by lancewillett. View the logs.


10 years ago

#14 @lancewillett
10 years ago

Discussing in IRC today (see handy link above) we decided to improve this by adding context to the more HTML and arrow output so translators know what it's for.

#15 @SergeyBiryukov
10 years ago

Context (as in _x()) is meant to distinguish the same string used in different context.

What we need here is a translator comment, like in [27284].

@lancewillett
10 years ago

Better translator context for the arrow

#16 @lancewillett
10 years ago

Thanks Sergey, good point.

#17 @lancewillett
10 years ago

  • Owner set to lancewillett
  • Resolution set to fixed
  • Status changed from new to closed

In 27589:

Twenty Fourteen: improve i18n in Ephemera widget for better translation of plurals for post format archives. Fixes #27069, props Chouby, SergeyBiryukov, lancewillett.

Note: See TracTickets for help on using tickets.