-
-
Notifications
You must be signed in to change notification settings - Fork 78
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
Safe translations applied #1089
Conversation
850ffeb
to
60d1329
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1089 +/- ##
==========================================
- Coverage 37.70% 35.70% -2.01%
==========================================
Files 123 132 +9
Lines 6598 7605 +1007
==========================================
+ Hits 2488 2715 +227
- Misses 4110 4890 +780 ☔ View full report in Codecov by Sentry. |
1f7061f
to
713161a
Compare
@BPerlakiH Here we need to generate an error in CI instead of just warnings if:
|
713161a
to
2f8fd6f
Compare
@kelson42 , no problem, please see it updated. |
@BPerlakiH Woukd like to merge it and will do it.... once CI passes :) |
@kelson42 now it seems to be good. There's still "flaky-ness" on the CI part (regardless of the changes in this PR) :( |
2f8fd6f
to
e39238a
Compare
Fixes: #1088
How the translations work:
We have a key / value association for each language. English is the default and the reference one.
If a key is missing in another language, we want to fall-back to English. This fallback is a custom solution, Apple doesn't do this for us.
How it worked so far:
We were using the keys in the code, and applied the
"payment.confirm.button.title".localized
extension on it (our custom fallback function, or in some rare cases the"".localizedWithFormat(withArgs: ..)
function, that can handle placeholders.How could it go wrong:
.localized
, it will work in English, but won't fall back to English for languages, that do not have this translation yet.What else can be (and now is) improved:
Solution:
Generate
static let payment_confirm_button_title = "payment.confirm.button.title".localized
.localized
and the"".localizedWithFormat(withArgs: ..)
function file private. This way it can not be used directly. This avoids the problem of eg. re-applying it twice on the same value, or using it on some other keys, the translation file doesn't know of.Validate
Notes on additional changes
Therefore in light of the above, I have: