-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
feat: Add test to check Nutri-Score, Eco-Score and NOVA are not translated #6085
Conversation
Kudos, SonarCloud Quality Gate passed! |
|
I got same problems as @teolemon |
The point of this test is to find all instances of translations that (wrongly) translated Nutri-Score, Eco-Score and NOVA. It will not pass untill all those are fixed in CrowdIn. Once all translations are corrected, we can merge this test, and then new translations PRs from CrowdIn won't pass if they have new wrong translations. |
t/lang.t
Outdated
|
||
foreach my $stringid (sort keys %Lang) { | ||
foreach my $word (@words_that_should_not_be_translated) { | ||
if ($Lang{$stringid}{'en'} =~ /\b$word\b/) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't notice how much it took to run this, but using a regexp with all words and matching once, should be roughly 3x faster.
/\b(Nutri-Score|Eco-Score|NOVA)\b
I imagine that checking the same regexp in translation (whithout searching which one it is), is engouh, but if needed, we can do an inner loop to then check each words.
b7cced2
to
a97e38a
Compare
@stephanegigandet what do we want to do with this PR ? Abandon it ? We can fix part of translations strings, but do you really feel that Nutri-Score should remain Nutri-Score in arabic ? |
Kudos, SonarCloud Quality Gate passed! |
Implementing perltidy to t/lang.t , will have a merge commit with PR #6085
Kudos, SonarCloud Quality Gate passed! |
Removed some broken tests, here are the stats on languages with failing tests:
|
From @alexgarel :
Let's merge it for French, then we can gradually add more languages as we solve them in Crowd-in. I solved the French issues in fr.po and in Crowdin (Éco-Score --> Eco-Score). The test is activated only or French. We can merge it, and then make another PR where we activate it for more languages. |
Creating po_backend_run ... done tests/unit/lang.t: Begin Error Output Stream |
Kudos, SonarCloud Quality Gate passed! |
This checks that if there is Nutri-Score, Eco-Score or NOVA in an English string, that it has not been changed in all the translations.
Currently this test fails:
Looks like you failed 142 tests
Sample output:
not ok 877 - string nutrition_grade_fr_tea_bags_note in language ro does not contain Nutri-Score: Notă: Nutri-Scorul ceaiurilor și ceaiurilor din plante corespunde produsului preparat doar cu apă, fără zahăr sau lapte.
There are some languages where Nutri-Score is being changed according to grammatical rules for nouns, we will need to check, but we probably want to treat Nutri-Score as a brand that cannot be changed. e.g. in English, we should say "The Nutri-Score of several products" and not "The Nutri-Scores of several products".