zulip / zulip-mobile

Zulip mobile apps for Android and iOS.
https://zulip.com/apps/
Apache License 2.0
1.29k stars 651 forks source link

Translate remaining text #1529

Open borisyankov opened 6 years ago

borisyankov commented 6 years ago

(Edited.)

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

More?

kunall17 commented 6 years ago

@zulipbot claim

rk-for-zulip commented 4 years ago
  • [ ] 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 commented 4 years ago

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

rk-for-zulip commented 4 years ago
  • [ ] "... 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! :expressionless:

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.)