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

feat: check {variables} are kept in translations #6709

Merged
merged 4 commits into from
May 18, 2022
Merged

Conversation

stephanegigandet
Copy link
Contributor

Related to #6702

This PR makes the tests fail if some translations removed some {variables}:

not ok 743 - f_app_user translation in uk contains {app_name}
#   Failed test 'f_app_user translation in uk contains {app_name}'
#   at lang.t line 91.
Wide character in print at /opt/perl/local/lib/perl5/Test2/Formatter/TAP.pm line 125.
#                   'Користувач додатку'
#     doesn't match '(?^u:\{app_name\})'
not ok 744 - f_energy_expenditure_for_weight_in_kg_lb translation in uk contains {kg}
#   Failed test 'f_energy_expenditure_for_weight_in_kg_lb translation in uk contains {kg}'
#   at lang.t line 91.
Wide character in print at /opt/perl/local/lib/perl5/Test2/Formatter/TAP.pm line 125.
#                   'Використання енергії для людини вагою кг/ фунт'
#     doesn't match '(?^u:\{kg\})'
not ok 745 - f_energy_expenditure_for_weight_in_kg_lb translation in uk contains {lb}
#   Failed test 'f_energy_expenditure_for_weight_in_kg_lb translation in uk contains {lb}'
#   at lang.t line 91.
Wide character in print at /opt/perl/local/lib/perl5/Test2/Formatter/TAP.pm line 125.
#                   'Використання енергії для людини вагою кг/ фунт'
#     doesn't match '(?^u:\{lb\})'
not ok 746 - f_nova_markers_for_nova_group translation in es contains {nova_group}
#   Failed test 'f_nova_markers_for_nova_group translation in es contains {nova_group}'
#   at lang.t line 91.
#                   'Elementos que indican que el producto se encuentra en el grupo(nova_group)'
#     doesn't match '(?^u:\{nova_group\})'
Use of uninitialized value in pattern match (m//) at lang.t line 85.
en: Elements that indicate the product is in the {nova_group} group
es: Elementos que indican que el producto se encuentra en el grupo(nova_group)
1..746
# Looks like you failed 4 tests of 746.

@stephanegigandet stephanegigandet requested a review from a team as a code owner April 27, 2022 16:34
@stephanegigandet stephanegigandet added the Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org label Apr 27, 2022
@teolemon
Copy link
Member

I've made fixes in crowdin. Changes should sync tomorrow

@github-actions github-actions bot removed the Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org label Apr 28, 2022
@teolemon teolemon linked an issue Apr 28, 2022 that may be closed by this pull request
Copy link
Member

@alexgarel alexgarel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

t/lang.t Outdated
}

print "en: $Lang{f_nova_markers_for_nova_group}{en}\n";
print "es: $Lang{f_nova_markers_for_nova_group}{es}\n";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those two lines should be removed ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good catch, I removed them.

t/lang.t Outdated Show resolved Hide resolved
t/lang.t Show resolved Hide resolved
@alexgarel
Copy link
Member

@teolemon still got:

2022-04-28T09:05:25.9846907Z #                   'Bu hesap üretici veya marka(org). ile ilişkili profesyonel bir hesaptır. Üreticiler için olan Platforma erişiminiz vardır.'
2022-04-28T09:05:25.9847332Z #     doesn't match '(?^u:\{org\})'

@alexgarel
Copy link
Member

Lost_in_Translation_poster

Could'nt help it 😬

@teolemon
Copy link
Member

thanks @alexgarel, fixed in crowdin

@alexgarel alexgarel force-pushed the lang-variables-test branch from 2cfbf96 to 384fbde Compare April 29, 2022 08:01
@alexgarel
Copy link
Member

still failing after crowdin merge @teolemon !

@stephanegigandet do the script reports all problems, or just part of them ?

2022-04-29T08:18:26.0939365Z 
2022-04-29T08:18:26.0939823Z #   Failed test 'f_move_data_and_photos_to_main_language translation in tr contains {language}'
2022-04-29T08:18:26.0940137Z #   at t/lang.t line 91.
2022-04-29T08:18:26.0940444Z Wide character in print at /opt/perl/local/lib/perl5/Test2/Formatter/TAP.pm line 125.
2022-04-29T08:18:26.0941066Z #                   '(dilindeki) seçilen fotoğrafları ve tüm verileri ürünün ana diline yerleştirin(ana dil)'
2022-04-29T08:18:26.0941462Z #     doesn't match '(?^u:\{language\})'
2022-04-29T08:18:26.0941618Z 
2022-04-29T08:18:26.0941913Z #   Failed test 'f_move_data_and_photos_to_main_language translation in tr contains {main_language}'
2022-04-29T08:18:26.0942238Z #   at t/lang.t line 91.
2022-04-29T08:18:26.0942549Z Wide character in print at /opt/perl/local/lib/perl5/Test2/Formatter/TAP.pm line 125.
2022-04-29T08:18:26.0943082Z #                   '(dilindeki) seçilen fotoğrafları ve tüm verileri ürünün ana diline yerleştirin(ana dil)'
2022-04-29T08:18:26.0943468Z #     doesn't match '(?^u:\{main_language\})'
2022-04-29T08:18:26.0943780Z Use of uninitialized value in pattern match (m//) at t/lang.t line 85.

@stephanegigandet
Copy link
Contributor Author

@stephanegigandet do the script reports all problems, or just part of them ?

all of them

@alexgarel alexgarel force-pushed the lang-variables-test branch from 2bd2c98 to 061ebc7 Compare May 17, 2022 09:55
@github-actions github-actions bot added the Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org label May 18, 2022
@alexgarel
Copy link
Member

I fixed the problem on a Turkish string (in the file and in crowdin) to be able to merge this PR.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

@alexgarel alexgarel merged commit fdbd7f3 into main May 18, 2022
@alexgarel alexgarel deleted the lang-variables-test branch May 18, 2022 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧪 tests Translations We use a non-standard version of GetText, lack language variants support translate.openfoodfacts.org
Projects
Development

Successfully merging this pull request may close these issues.

Há uma coisa NOVA
3 participants