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

Update localization plugin to support expressions #654

Merged
merged 1 commit into from
Sep 12, 2018

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Sep 7, 2018

This PR updates our localization plugin to support expressions (also backwards compatible with our old token syntax setup). Atm it requires a beta.1 build of the Mapbox Maps SDK for Android, as it requires mapbox/mapbox-gl-native#12769 and mapbox/mapbox-gl-native#12768 to be fixed upstream. We will have to hold off merging and releasing this plugin until 6.5.0 final has been released, eta 1 week.

One issue I had with migration is that some step expression returned from core contain an invalid representation. On this line I'm fixing this up by introducing an additional 0 stop output based on the current locale. This fix will not break if the issue is fixed upstream though would love to remove it at some point.

String text = textFieldExpression.toString().replaceAll(EXPRESSION_REGEX, mapLocale.getMapLanguage());
if (text.startsWith("[\"step") && textFieldExpression.toArray().length % 2 == 0) {
// got an invalid step expression from core, we need to add an additional name_x into step
text = text.replaceAll(STEP_REGEX, String.format(STEP_TEMPLATE, mapLocale.getMapLanguage()));
Copy link
Contributor

@1ec5 1ec5 Sep 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobrun tobrun force-pushed the tvn-upgrade-local-to-expressions branch from 1db7e50 to bf53ce7 Compare September 12, 2018 11:30
@tobrun tobrun force-pushed the tvn-upgrade-local-to-expressions branch from bf53ce7 to e03584f Compare September 12, 2018 11:42
@tobrun tobrun merged commit 2caaa9e into master Sep 12, 2018
@tobrun tobrun deleted the tvn-upgrade-local-to-expressions branch September 12, 2018 12:15
@LukasPaczos LukasPaczos added this to the localization-0.5.0 milestone Sep 12, 2018
@LukasPaczos LukasPaczos mentioned this pull request Sep 12, 2018
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants