elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.69k stars 8.24k forks source link

i18n: Pseudo locale masking improper translation structures #38234

Open clintandrewhall opened 5 years ago

clintandrewhall commented 5 years ago

Needs further discussion if we need a list of non-translatable values.

As I've been applying translation to Canvas, I've been using the en-xa locale to test my changes. @w33ble pointed out in #37381 that values not meant to be translated were being replaced by the regex, making it confusing as to what should and should not be translated.

I chatted with @Bamieh and isolated the pseudo-locale code and realized the string replacement was happening after the static values were put in place.

I now have a PR to change that behavior, and it's already starting to show what I consider to be bugs. For example, Kibana and Elastic should be reserved (trademarked, product, etc) words... and yet loading Kibana with my change shows that those words were not treated as values.

I'll be creating my PR shortly, but I wanted to file this issue with two points:

  1. We shouldn't pseudo-translate static values, and
  2. We should probably double-check for improperly formatted strings throughout Kibana, (assuming my assumption above is correct).
elasticmachine commented 5 years ago

Pinging @elastic/kibana-stack-services

clintandrewhall commented 5 years ago

Here are a couple of (what I consider) translation issues. Regardless, in Canvas, keywords like expression functions and parameters would need to be sure they were not translated, so the changes in #38236 are valuable there.

Before:

Screen Shot 2019-06-06 at 2 21 15 AM Screen Shot 2019-06-06 at 2 45 06 AM

After:

Screen Shot 2019-06-06 at 2 41 46 AM Screen Shot 2019-06-06 at 2 45 13 AM

Bamieh commented 5 years ago

Thank you for writing this. I messaged @chiweichang to chime in on this since she is very knowledgable about this topic.

Regarding this:

We should probably double-check for improperly formatted strings throughout Kibana, (assuming my assumption above is correct).

AFAIK Translators use a dictionary for reserved words so the previous behavior should not affect their work flow.

I am ++ on this from a developers' perspective. My only concern is if we need to keep the old behavior en-xa and introduce this under a new locale. Something like en-xa-dv

clintandrewhall commented 5 years ago

Perhaps reserved words are a bad example, but still: variables should not be translated in en-xa because they won't be translated in real life. As of now, en-xa produces and end result that is inconsistent with the API.

Creating another locale will only mask (and continue to mask) the issue, IMHO.

clintandrewhall commented 5 years ago

@chiweichang Understood... so does that mean that my #38236 is acceptable?

elasticmachine commented 3 years ago

Pinging @elastic/kibana-core (Team:Core)