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

Translate remaining text #1529

Open
2 of 10 tasks
borisyankov opened this issue Dec 12, 2017 · 4 comments
Open
2 of 10 tasks

Translate remaining text #1529

borisyankov opened this issue Dec 12, 2017 · 4 comments
Labels
a-i18n Translation, localization, internationalization help wanted

Comments

@borisyankov
Copy link
Contributor

borisyankov commented Dec 12, 2017

(Edited.)

These need to be marked with _ which comes from withGetText. To find examples, look at checked-off items below.

  • "... Local time" in AccountDetails.js
  • LightboxActionSheet.js & other action sheets
  • showToast & showErrorAlert
    • in lightboxActionSheet.js
    • in lightboxShareImage.js
    • in messageActionSheet.js
    • in webViewEventHandlers.js
  • relative times ('10 days ago' etc.) -- this one is harder than others, see comment below
    • Messages calculated change time (?)
    • last active time from user presence

More?

@kunall17
Copy link
Contributor

@zulipbot claim

@gnprice gnprice added the a-a11y Accessibility label Feb 20, 2020
@rk-for-zulip rk-for-zulip added a-i18n Translation, localization, internationalization and removed a-a11y Accessibility labels Apr 17, 2020
@rk-for-zulip
Copy link
Contributor

rk-for-zulip commented Apr 17, 2020

  • Messages calculated change time ('10 days ago' etc.)

Since I've just dug into this a bit:

Currently we use date-fns to generate the human-oriented approximate times from the relevant timespan. date-fns does allow for translations, but it almost requires that locales be individually imported. This is doable today, but would be easier with some automated solution to #3895.

Nowadays, there's also an Intl.RelativeTimeFormat interface (not available to us directly, but there are po[ln]yfill libraries) which can be used to generate relative times in various languages. However, it requires precisely specifying units: there's no facility to automatically and/or approximately describe a timespan.

Addendum: Also, even the latest version of date-fns appears to have no Malayalam support (though it has all the other languages we currently provide).

@rk-for-zulip
Copy link
Contributor

Addendum: moment.js has a similar facility, though it lacks the fuzzy "about" durations of date-fns.

@rk-for-zulip
Copy link
Contributor

  • "... Local time" in AccountDetails.js

The "Local time" part is trivial; as always, the devil's in the "...". Time format localization is a big hairy mess.

Fortunately, we have react-intl! Simply using a message "{timestamp, time, short} local time" and supplying the timestamp (in milliseconds) formats the string exactly as desired: "4:12 PM local time" in English, "16.12 paikallinen aika" in Finnish (or whatever should be in messages_fi), and so on.

... but only in debug mode. In release, it does nothing! 😑

Specifically, it just prints as the literal string "{timestamp, time, short} local time". Presumably this is because the debug version is running remotely on Chrome, and so is tapping into the browser's implementation of Intl, while in release, of course, we're running on a pre-Intl version of JavaScriptCore. Running in debug mode without remote execution gives some interesting errors about unloaded locale data – even for en – which may be resolvable; StackOverflow has suggestions for related problems.)

Alternatively, we may be able to have moment.js into formatting it for us. Again, there seem to be subtleties involving loading locale data. (moment.js may be needed anyway; I was unable to convince the timezone library to provide the timezone-adjusted timestamp desired by Intl.)

Alternatively again, we may be able to flip the switch in (sigh) RN 0.60's build.gradle that tells it to use an Intl-enabled version of JavaScriptCore. We can even upgrade to a much later version with jsc-android. (Technically we could do this last in 0.59, but it would complicate the RN upgrade needlessly.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-i18n Translation, localization, internationalization help wanted
Projects
None yet
Development

No branches or pull requests

6 participants