Support for localization in PkPass files #8
Labels
package: passkit_ui
Issues relevant for the "passkit_ui" package
package: passkit
Issues relevant for the "passkit" package
prio: high
High prioritity
Text can be localized, but images can be localized too.
PkPass docs for localizations (text and images):
Docs for
.strings
file format description:.strings
files are UTF-16 not UTF-8, so the files have to be read like this StackOverflow post suggests. This issue dart-lang/core#266 contains some hints too.There are various approaches to parsing a
.strings
file:petiteparser
Personally, I would like to see a custom parser based on
petiteparser
with all the bells and whistles, but I think using a RegEx at first should be sufficient.The API could look like one of the following examples:
With
intl
This paragraph is only relevant for
passkit_UI
Language fallback rules (should be applied on a per field basis):
de_DE
)Localizations.of(context).locale
de
instead ofde_DE
)Localizations.of(context).locale
PlatformDispatcher.locales
(while skipping already tried languages)de_DE
), then without (justde
)Formatted values like dates, numbers, etc are always localized to the users' current language (as described here)
The default localized value should be https://api.dart.dev/stable/3.4.4/dart-io/Platform/localeName.html on dart:io and whatever browser equivalent there is. On Flutter it should use the Localization.of().locale as default.
The text was updated successfully, but these errors were encountered: