Repository navigation
Check if plural forms are correct for languages. - #55327
Conversation
|
It turned out that we had bad plural forms for:
We should fix that (I know in some languages it matters less than in others) but I guess we should fix those :) after we merge the fix. In short - for those who do not realise it - when we count stuff the translations might be different for different numbers (1, 2, 5, 6 might all have different translations). i18n supports it - we need to just specify which "forms" each language has. We had support for it but it was a default fallback and some languages had no proper forms defined - I fixed the configuration (and made sure we have to specify forms for each language in the future) in this PR. And after this one is merged, you should run your language with Sorry for so late notice - but I realised it only yesterday that we probably dropped a few small balls here :) |
2e3d5fe to
3b08318
Compare
shahar1
left a comment
There was a problem hiding this comment.
Small nit, otherwise LGTM :)
3b08318 to
55a92a1
Compare
It turned out, that some of the languages we had, did not have proper plural forms defined. There were few problems with it: * some languages had "default" form defined where they should have other forms * there were no check if language was missing in the plural forms, so new languages got the "default" form by - well - default. * we had no check in CI to check if languages are defined in the plural forms This PR modifies the `check-translations-completeness` script and uses it as a prek (manual) hook to make it easier to get run, also to be able to run it in CI - it exits with non-zero exit only when there is a clear issue with configuration or call parameters, rather than when there are missing translations, it only prints green/red message summarizing the output.
55a92a1 to
0d70277
Compare
Co-authored-by: Shahar Epstein <[email protected]>
|
The nice thing about it is that we should see the completeness report now printed in all the PRs and canary runs in a separate CI job. |
|
There you go: nice report, straight in the PR: https://github.com/apache/airflow/actions/runs/17516289587/job/49754216405?pr=55327#step:4:1 |
|
And the |
Backport failed to create: v3-0-test. View the failure log Run details
You can attempt to backport this manually by running: cherry_picker eda82ca v3-0-testThis should apply the commit to the v3-0-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continue |
|
Will update the missing once soon. Thanks Jarek! |
Note: should not backport. |
|
In addition to the rules provided in the i18n jsfiddle, we might want to consider rules for floats. See discussion in the Factorio project as an example. Also, it is conceivable there might be cases where translators want to add a case that's not defined in i18n for their language, e.g. |
Good point, but I don't think we have floats in Airflow UI phrases. Looklng at the current phrases we have exclusively counts and strings - and it's quite unlikely we will ever have floats. And even if we would have i18next library we use already has all the rules necessary it seems for example https://www.i18next.com/translation-function/formatting (for decimal formatiing, but also dates, time, relative time etc. ). Also for plural forms for decimal numbers, they seem to be included already - for example
Yep, if we get to the point i18next has the option to use custom formatters https://www.i18next.com/translation-function/formatting and we can specify which formatters we should use when it comes to it. I actualy found i18next (it seems it's been refactored and rewritten failrly recently) as very comprehensive and helpful for all internationalisation rules. |
The checker computed its per-file statistics inside the rich table rendering loop, so the report existed only as terminal output. Extract the aggregation into build_completeness_report() and add a --json flag that prints the same data as a single JSON document on stdout — following the breeze ci verify --json pattern (apache#73241): narration is suppressed (or sent to stderr with --verbose) so the output can be piped straight to jq. The default output stays byte-identical, exit-code semantics are unchanged (apache#55327), and the existing --language/--add-missing/ --remove-unused flags compose with --json. closes: apache#75772 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01A18rBgPJ6X4oXAzsecJjnz
The checker computed its per-file statistics inside the rich table rendering loop, so the report existed only as terminal output. Extract the aggregation into build_completeness_report() and add a --json flag that prints the same data as a single JSON document on stdout — following the breeze ci verify --json pattern (#73241): narration is suppressed (or sent to stderr with --verbose) so the output can be piped straight to jq. The default output stays byte-identical, exit-code semantics are unchanged (#55327), and the existing --language/--add-missing/ --remove-unused flags compose with --json. closes: #75772 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01A18rBgPJ6X4oXAzsecJjnz
It turned out, that some of the languages we had, did not have proper plural forms defined. There were few problems with it:
This PR modifies the
check-translations-completenessscript and uses it as a prek (manual) hook to make it easier to get run, also to be able to run it in CI - it exits with non-zero exit only when there is a clear issue with configuration or call parameters, rather than when there are missing translations, it only prints green/red message summarizing the output.^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in airflow-core/newsfragments.