-
Notifications
You must be signed in to change notification settings - Fork 3
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
904: Add i18n for translations #1103
Conversation
Just a general comment: Did you consider using the "standard flutter" approach of localization as described in their docs? |
@michael-markl tbh just because I am used to react-native where you need a library for everything, so I didn't even check. However, one thing that does not work with the standard flutter approach: It uses .arb files intstead of normal .json files which doesn't support namespaces. What would works is keys like Opinions on whether we should use the standard way and work around the namespace issue or stick to the current library? @michael-markl @f1sh1918 @sarahsporck |
@steffenkleinle According to the ARB spec (see https://github.com/google/app-resource-bundle/wiki/ApplicationResourceBundleSpecification#arb-namespace-and-registration) there might be some namespace support, however, I don't know whether the Flutter implementation supports this. |
One benefit of the ARB-way would be "type"-safety (in the sense that you cannot misspell translation keys) as special Dart code is generated from the ARB file (if I understand correctly). (It's not a recommendation from me, but I am kind of interested in these ARB files. I like that (a) the translation files have some proper spec, and (b) that translation keys can also hold meta data like a description or a screenshot). |
Agreeing with all the points. One drawback would be that the tools we use in the integreat project to handle constants won't work anymore/would need some adjustments. I think I would still give those ARB files a try, because I think the typesafety is a huge pro. |
2b6301c
to
2353756
Compare
52ff5d2
to
e59e401
Compare
A few notes, while in general the localization works pretty nice (typesafety 🎉), it seems like no features are really implemented at the moment and there are a few problems for us:
All in all it seems like a great tool in general but not that actively maintained/improved. It might work for us for now but also might have too many limitations in the future. |
This should work so far, if you change something in |
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.
Tested on android and ios seem to work fine for both even they recommend in the docs to add this into Info.plist
.
Seem not to be require anymore.
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>ar</string>
</array>
Even tested using different system languages on device
frontend/lib/identification/activation_workflow/activation_code_scanner_page.dart
Outdated
Show resolved
Hide resolved
frontend/lib/identification/activation_workflow/activation_code_scanner_page.dart
Show resolved
Hide resolved
frontend/lib/identification/activation_workflow/activation_overwrite_existing_dialog.dart
Outdated
Show resolved
Hide resolved
frontend/lib/identification/card_detail_view/card_detail_view.dart
Outdated
Show resolved
Hide resolved
e, | ||
); | ||
} on QrCodeParseException catch (e) { | ||
await _onError( | ||
context, | ||
'Der Inhalt des eingescannten Codes kann nicht verstanden ' |
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.
does this break lines like before? I think each quote part is for one line
But i think its also fine if it breaks automatically. Maybe only on tablets an issue
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.
No, it doesn't lead to the same linebreaks anymore. Let me know if I should readd them. Personally I think its perhaps better to let flutter handle it depending on the screen size?
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.
Will keep it as it is :)
# Conflicts: # frontend/lib/identification/card_detail_view/card_detail_view.dart # frontend/lib/identification/identification_page.dart
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.
Looks good!
Short description
This PR extracts all user visible text constants to a new arb file asset and adds general support for i18n.
Proposed changes
Fixes #904.