Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n: Add plural variant to strings using timeLapsed variable #247

Closed
rachelmcr opened this issue Nov 19, 2015 · 7 comments
Closed

i18n: Add plural variant to strings using timeLapsed variable #247

rachelmcr opened this issue Nov 19, 2015 · 7 comments
Labels
[Feature] Stats Everything related to our analytics product at /stats/ i18n [Status] Stale [Type] Bug

Comments

@rachelmcr
Copy link
Member

The variable %(timeLapsed)s is used in the following stats string:

It's been %(timeLapsed)s since {{href}}{{postTitle/}}{{/href}} was published. Here's how the post has performed so far...

Because this variable can have a plural value ("day" or "days"), the string must have singular and plural variations for translation. This allows for different singular and plural translations for languages that translate the string differently depending on that variable's value.

In this case, for example, English always uses the singular "It's been" whether you are talking about 1 day or 10 days. However, other languages may use a plural conjugation when talking about multiple days, as in German:

"ist ... vergangen" when we're talking about one day|week|month|year (singular) and "sind ... vergangen" when it's more than one day|week|month|year.

As a result, the singular/plural variants have to be provided within a single translated string, for example ist|sind in the German translation:

Seit der Veröffentlichung von {{href}}{{postTitle/}}{{/href}} ist|sind %(timeLapsed)s vergangen. Hier siehst du, wie es dem Beitrag bisher ergangen ist ...

Reported here: https://en.forums.wordpress.com/topic/timelapsed-variable-content

@rachelmcr rachelmcr added [Type] Enhancement [Feature] Stats Everything related to our analytics product at /stats/ i18n [Type] Bug and removed [Type] Enhancement labels Nov 19, 2015
@nylen
Copy link
Contributor

nylen commented Jan 6, 2016

I looked into this a bit. If I'm reading correctly, there's not a simple fix that I can see. We could change the translated string to include a singular and plural variant, but this wouldn't fix the timeLapsed text because it is coming from the moment library: http://momentjs.com/docs/#/displaying/fromnow/

I was not able to find where we localize moment's date behavior, if we do at all.

@lancewillett
Copy link
Contributor

@nylen Is it set here?

moment.locale( i18nState.localeSlug, momentLocale );

From http://momentjs.com/docs/#/i18n/loading-into-nodejs/

@hoverduck
Copy link
Contributor

@rachelmcr I think this is fixed, can you confirm? My German is rusty (i.e. non-existent), but Google Translate says this looks better:

screen shot 2016-05-05 at 12 34 38 pm

@rachelmcr
Copy link
Member Author

It isn't fixed — that string still only provides one translation, instead of a single and plural variant. In German, it's translated always as the plural variant:

https://translate.wordpress.com/projects/wpcom/de/default/?filters[status]=either&filters[original_id]=201613&filters[translation_id]=5679778

Here's an example when timeLapsed returns text that would call for a singular variant ("one day"/"ein Tag"):

screen shot 2016-05-12 at 1 33 55 pm

(That also exposes an issue with capitalization, since the timeLapsed text appears at the start of the translated sentence.)

It's a complicated issue because the correct variant depends on the value returned for timeLapsed.

@rachelmcr
Copy link
Member Author

I re-tested this and confirmed it is still an issue.

@hoverduck
Copy link
Contributor

#bug-scrub

I haven't learned German in the 7 months since I last looked at this, but I don't think it's fixed.

@nylen, you looked at this briefly back when @rachelmcr first wrote the issue...have you had any epiphanies since then? Is there a milestone or project we could stick this on so it gets looked at sooner?

@stale
Copy link

stale bot commented Jan 11, 2018

This issue has been marked as stale because it hasn't been updated in a while. It will be closed in a week.
If you would like it to remain open, can you please you comment below and see what you can do to get things moving with this issue?
Thanks! 🙏

@stale stale bot added the [Status] Stale label Jan 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Stats Everything related to our analytics product at /stats/ i18n [Status] Stale [Type] Bug
Projects
None yet
Development

No branches or pull requests

4 participants