photoprism-mobile
photoprism-mobile copied to clipboard
[Feature Request] Multi-Language Support
Hi,
What about translating the app into more languages. See: https://flutter.dev/docs/development/accessibility-and-localization/internationalization
I could support by translating into German - if needed -
Edit: For now just add the language which are supported by photoprism too?
So, went ahead and tried a couple different options for a localization framework.
easy_localization:
Looks like one of the better packages for Flutter. Fairly clean code. It'd need a little work to pull from the main photoprism project.
Sample: https://github.com/skyeskie/photoprism-mobile/tree/easy_localization
BottomNavigationBarItem(
icon: Icon(Icons.photo),
title: const Text('Photos').tr(),
),
flutter_intl
Has plugins for some refactoring help, but main positive here is integration with https://localizely.com/ (free open source option) for a UI for translators. The code itself is a little messy to use (requiring a BuilderContext
to access translations).
Sample: https://github.com/skyeskie/photoprism-mobile/tree/flutter_intl
BottomNavigationBarItem(
icon: const Icon(Icons.photo),
title: Text(S.of(context).photos),
),
Gettext equivalents
- https://pub.dev/packages/gettext
- https://pub.dev/packages/gettext_parser - read
mo
andpo
files - flutter package (but Git only): https://github.com/cah4a/flutter_gettext
No actual text extraction. Just ports of the NPM packages to read the gettext formats.
Sample (haven't done full branch):
BottomNavigationBarItem(
icon: const Icon(Icons.photo),
title: Text(gt.gettext('Photos')),
),
Only option that'd directly take po
or mo
files from the main project. Also, under the flutter package, looks like it has options to compile into dart
files directly. However, looks like the flutter part is abandoned, not known how complete.
One of the things to consider - where should we keep the translations?
- Unified, in the main
photoprism/photoprism
repository - Unified, in a new
photoprism/lang
- Unified in a third-party site (Google Sheets / localizely.com as above / etc)
- Managed separately (Same format or no?)
Something unified would keep consistent messaging and enable displayable text to be sent in the server API responses. However, it'd be a bit of a hassle to add new strings for translations.
Also, several of these frameworks have more advanced options than a simple text lookup. Those aren't used on the main photoprism UI, but that might be something to look into.