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

Multiple i18n strings are nearly identical #2800

Closed
ohadlevy opened this issue Nov 22, 2017 · 14 comments
Closed

Multiple i18n strings are nearly identical #2800

ohadlevy opened this issue Nov 22, 2017 · 14 comments

Comments

@ohadlevy
Copy link
Member

for example:

grep "no longer exist" locale/en/ManageIQ_UI_Classic.po |wc -l                                                           
31
where many of them are very similar:
msgid "%{models} no longer exists"
msgid "%{model} no longer exists"
msgid "%{model} no longer exists."
msgid "%{name} (no longer exists)"
msgid "%{record_name} no longer exists in the database"
msgid "%{record} no longer exists"
msgid "%{table} no longer exists"
msgid "Chart no longer exists"
msgid "Cloud Network no longer exists."
msgid "Cloud Subnet no longer exists."
msgid "Cloud Tenant no longer exists."
msgid "Cloud Volume Snapshot no longer exists."
msgid "Error: Record no longer exists in the database"
msgid "Floating IP no longer exists."
msgid "Last selected %{record_name} no longer exists"
msgid "Last selected Snapshot no longer exists"
msgid "MiqGroup no longer exists"
msgid "Policy no longer exists"
msgid "Provider no longer exists, this alert must be reconfigured"
msgid "RSS Feed no longer exists"
msgid "Report no longer exists"
msgid "Role no longer exists"
msgid "Router no longer exists."
msgid "Saved Report no longer exists"
msgid "Security Group no longer exists."
msgid "Selected %{model_name} no longer exists"
msgid "Selected Chargeback Report no longer exists"
msgid "Selected Saved Chargeback Report no longer exists"
msgid "Tenant no longer exists"
msgid "The selected job no longer exists, Delete all older Tasks was not completed"
msgid "User no longer exists"

I believe many of these can be extracted with a parameter, e.g. use:
_("String with param: %s") % param
or with multiple parameters:
_("Params: %{a} and %{b}") % {:a => foo, :b => bar}

Further, to use plural form use n_("One", "Two", number) - note this function always accepts three parameters as the base language is usually English but translators are able to define as many plural forms as they need.
Plural forms are usually used with one parameter, do not forget to add trailing parameter to it: n_("%s minute", "%s minutes", @param) % @param
Note that gettext does not extract from interpolation - this will not work: "blah #{_('key')} blah"

@ohadlevy ohadlevy changed the title multiple i18n strings are nearly identical Multiple i18n strings are nearly identical Nov 22, 2017
@martinpovolny
Copy link
Member

martinpovolny commented Nov 23, 2017

@ohadlevy: some of this is covered in: http://manageiq.org/docs/guides/i18n

note: any unification here is good on one side, on the other it may break the QE automation

@ohadlevy
Copy link
Member Author

ohadlevy commented Nov 23, 2017 via email

@mzazrivec
Copy link
Contributor

I don't quite understand what problem this report points to.

@ohadlevy
Copy link
Member Author

the point is that you can reduce the number of different strings - this simply adds burden on translators often leaving the application in semi translated state - where in fact, the same strings are already translated.
for example:

msgid "Report no longer exists"
msgid "Role no longer exists"

are identical strings, and in fact, already covered by

msgid "%{model} no longer exists."

and

msgid "%{model} no longer exists"

@mzazrivec
Copy link
Contributor

In fact, we're deliberately moving away from

msgid "%{model} no longer exists"

and replacing them with

msgid "Report no longer exists"
msgid "Role no longer exists"

when possible.

I get constantly asked by our translators what's %{model} in this case. What's %{model} in that case.
Since depending on the context, they would translate the string differently.

I'm all for unification and simplifying things when it's possible. Though what you're describing above
works reliably in English (and perhaps few other languages). It wouldn't work in languages with more
complicated conjugation and inflection rules.

@martinpovolny
Copy link
Member

martinpovolny commented Nov 23, 2017

I think that cleanup is on the way. But the result should be:

msgid "RSS Feed no longer exists"
msgid "Report no longer exists"
msgid "Role no longer exists"
msgid "Router no longer exists"

Rather than:

msgid "%{model} no longer exists"

It's more strings but, as @mzazrivec wrote, generally it gives more flexibility to the translators.

@martinpovolny
Copy link
Member

Especially these should go:

msgid "%{record} no longer exists"
msgid "%{table} no longer exists"

@ohadlevy
Copy link
Member Author

👍 also the inconsistency with and without a dot ?

@martinpovolny
Copy link
Member

@ohadlevy : Fixed that. Thx!

@miq-bot
Copy link
Member

miq-bot commented May 28, 2018

This issue has been automatically marked as stale because it has not been updated for at least 6 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions!

@miq-bot miq-bot added the stale label May 28, 2018
@JPrause
Copy link
Member

JPrause commented Jan 28, 2019

@martinpovolny is this still a valid issue? If yes, lease remove the stale label. If not can you close.
If there's no update by next week, I'll be closing this issue.

@JPrause
Copy link
Member

JPrause commented Feb 6, 2019

Closing issue. If you feel the issue needs to remain open, please either reopen or let me know and it will be reopened.
@miq-bot close_issue

@miq-bot miq-bot closed this as completed Feb 6, 2019
@martinpovolny martinpovolny reopened this Feb 7, 2019
@JPrause
Copy link
Member

JPrause commented Feb 7, 2019

@miq-bot remove_label stale

@miq-bot miq-bot removed the stale label Feb 7, 2019
@miq-bot
Copy link
Member

miq-bot commented Aug 12, 2019

This issue has been automatically marked as stale because it has not been updated for at least 6 months.

If you can still reproduce this issue on the current release or on master, please reply with all of the information you have about it in order to keep the issue open.

Thank you for all your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants