Skip to content
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

Add i18n support using java property files #134

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

HenrikJannsen
Copy link
Contributor

@HenrikJannsen HenrikJannsen commented Dec 20, 2024

Known issues/missing:

  • Not working yet on ios. files need to be added to ios resources and loaded.
  • Processing of the file content need more work (manual linebreaks not detected yet)
  • Testing

Loading if the resources takes a few ms. The size is about 260 kb per language.

We need to put the files in a sub directory in resources as otherwise it would conflict with the resources in node from the i18n jar.

We have for node the resources from the i18n jar already loaded, thus its wasteful to load it again. We could optimize that so that only android client loads the resources. In that case we could remove the mobile subdirectory as the conflict only happens in node. In fact for node we could just delegate the call to the bisq 2 API via Res.

It would be good if we could use only one location where we load the files for ios and android. Not sure if that is possible with the approach to load it from resources.
If not possible maybe a gradle task takes care that the ios files are always up to date with the android files. Or maybe someone has a better idea....

For the usage I used an extension function on String.
"myKey".i18n() or "myKey".i18n(1, "BTC") when arguments are passed.

If that style is not welcome feel free to change it.
In Bisq2 the api is: Res.get("myKey", 1, "BTC")

Not working yet on ios.
Processing of the file content need more work (manual linebreaks not detected yet) and testing.
@rodvar rodvar self-assigned this Dec 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants