Commit graph

52 commits

Author SHA1 Message Date
Aaron Raimist
752d816780
Fix some more lint errors
Signed-off-by: Aaron Raimist <aaron@raim.ist>
2018-10-11 22:06:01 -05:00
David Baker
0557737f8d Don't modify original options arg 2018-01-16 17:45:29 +00:00
David Baker
3cadb9b587 Fall back for missing i18n plurals
Counterpart doesn't do fallback if there is a translation for the
base string in the preferred language but not the required
pluralisation. This meant that if someone added some plurals to a
language or a string, but not all, you'd get completely empty
strings in the interface.

Work around this in the wrapper function.
2018-01-12 16:21:30 +00:00
Stefan Parviainen
713230e082 Add option to also output original string
This is useful for debugging and testing

Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-12-09 21:21:31 +01:00
Stefan Parviainen
df8a8f61e2 Fix logging of missing substitution variables
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-11-23 20:19:38 +01:00
Stefan Parviainen
414ee82582 Perform substitution on all parts, not just the last one
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>

This way the substitutions don't need to appear in the same order in the
translated string.
2017-11-17 08:47:31 +01:00
pafcu
342378f48a
Add space after if 2017-11-16 12:19:56 +01:00
Stefan Parviainen
2c1618bc10 Fix conflict and update strings
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-11-15 20:40:51 +01:00
Stefan Parviainen
ae252f7e59 Log if no match is found 2017-11-14 21:34:20 +01:00
Stefan Parviainen
788be67c75 Clarifications 2017-11-14 20:08:27 +01:00
Stefan Parviainen
772550a24a Dont't add empty nodes 2017-11-14 19:33:12 +01:00
Stefan Parviainen
3afbaf61e7 Refactor i18n stuff a bit 2017-11-13 20:19:33 +01:00
Travis Ralston
8282534f87 Add SettingsLevel enum; Move settings to own file.
Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-11-03 23:19:45 -06:00
Travis Ralston
893c39bfbe Merge branch 'develop' into travis/granular-settings 2017-11-03 22:00:07 -06:00
Stefan Parviainen
15bafd6818 Convert from weblate to counterpart at runtime to make tests happy
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-11-01 15:55:58 +01:00
Travis Ralston
0d3f0eaf98 Convert local settings to granular settings
This breaks language selection.

Signed-off-by: Travis Ralston <travpc@gmail.com>
2017-10-29 16:53:00 -06:00
Stefan Parviainen
f694fb24ff Fix merge-conflict
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-10-11 20:02:14 +02:00
Luke Barnard
d3f9a3aeb5 Run eslint --fix
Fixing 1000s of lint issues. Some rules cannot be `--fix`ed but this goes some way to linting the entire codebase.
2017-10-11 17:56:17 +01:00
Stefan Parviainen
52f3e1295b Don't use string interpolation in _tJsx as it uses regexes for that
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-10-11 09:14:11 +02:00
Stefan Parviainen
d4929b558e Add dummy translation function to mark translatable strings
Signed-off-by: Stefan Parviainen <pafcu@iki.fi>
2017-09-22 21:43:27 +02:00
Matthew Hodgson
946c439c28 hopefully fix https://github.com/vector-im/riot-web/issues/4166 2017-09-21 18:56:47 +01:00
Marcel
d34ba57adb Add missing returns 2017-08-24 16:42:32 +02:00
Marcel
88a0d34c2b Remove unused response_return variable 2017-08-24 15:40:52 +02:00
MTRNord
4a1ba01f44 fix deprecation warning 2017-08-13 00:56:37 +00:00
Richard van der Hoff
0d7cc59d99 replace q method calls with bluebird ones
```
find src test -name '*.js' |
    xargs perl -i -pe 's/q\.(all|defer|reject|delay|try|isFulfilled)\(/Promise.$1(/'
```
2017-07-12 18:05:40 +01:00
Richard van der Hoff
a06bd84213 replace imports of q with bluebird
update `package.json`

```
find src test -name '*.js' |
   xargs perl -i -pe 'if (/require\(.[qQ].\)/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'

find src test -name '*.js' |
   xargs perl -i -pe 'if (/import [qQ]/) { $_ = "import Promise from '\''bluebird'\'';\n"; }'
```
2017-07-12 18:05:08 +01:00
Richard van der Hoff
f37608a4ea Avoid React warning from _tJsx (#1078) 2017-06-12 16:45:36 +01:00
Matthew Hodgson
184c2d5e58 Merge pull request #1015 from matrix-org/t3chguy/random_fix_1
fix copy and paste derp and rip out unused imports
2017-06-06 18:02:35 +01:00
Kegsay
0b56d33bd2 Null guard all interpolated strings passed to _t (#1035) 2017-06-06 13:56:37 +01:00
Michael Telatynski
464863acd6 remove unused imports
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-06-02 21:35:55 +01:00
Marcel
8c2728ffc5 Revert changes of the key used 2017-06-01 21:10:58 +02:00
Marcel
924a8d1be0 Fix line change that should not happen 2017-06-01 21:03:43 +02:00
Marcel
51131ef7a5 Fix translation tests part 2 2017-06-01 21:02:40 +02:00
Marcel
cbf967a86d Fix tests
We do not have a en.json but a en_EN.json
2017-06-01 20:53:59 +02:00
Matthew Hodgson
8e34b59d32 Revert "Revert "add labels to language picker"" 2017-06-01 19:46:25 +01:00
Richard van der Hoff
b3e9716126 Revert "add labels to language picker" 2017-06-01 17:52:25 +01:00
daniel tygel
b8e26ddf3d add labels to language picker 2017-06-01 09:48:36 -03:00
Matthew Hodgson
d021598380 fix typo 2017-06-01 02:04:43 +01:00
Kegan Dougal
1ab52652f7 Strip out sanitizeHtml stuff as it's not required
As per https://github.com/matrix-org/matrix-react-sdk/pull/968#issuecomment-304946341
2017-05-31 09:29:43 +01:00
Kegan Dougal
63a998ceb7 Allow span... 2017-05-30 17:37:13 +01:00
Kegan Dougal
1d67358525 Make it work with multiple regexps 2017-05-30 16:17:42 +01:00
Kegan Dougal
bb030dabc4 Add _tJsx() 2017-05-30 15:55:21 +01:00
Michael Telatynski
c614c03b03 fix i18n in a situation where navigator.languages=[]
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2017-05-29 19:59:29 +01:00
David Baker
477396f820 Use first language preference, not last 2017-05-26 22:29:03 +01:00
David Baker
0f8e560247 Add function to display i18n keys in UI
Avoids having to load translations in riot-web tests
2017-05-26 15:29:11 +01:00
David Baker
e7fbf889fa Make current language more accurate
Make it reflect reality if it's been taken from the browser langs
by just getting what was saet in counterpart rather than the saved
setting.

Also fix style.
2017-05-25 19:53:27 +01:00
David Baker
39dbc4c6e1 Lots of changes to languageHandler
* Replace callbacks with promises
 * Move plain functions to top level
 * De-duplicate bits that fetched languages.json
 * Take full language preference list from the browser if we
   can get it, rather than just the first.
2017-05-25 16:45:32 +01:00
David Baker
db45e99536 Remove defaulting here
We already do it in the place this function gets called
2017-05-25 12:09:48 +01:00
David Baker
913723b76b Remove extCounterpart now we only use one instance 2017-05-25 12:08:14 +01:00
David Baker
ec146c7f45 Switch to stock counterpart
We no longer need the custom counterpart. The things that were
changed in it and reasosn we no lomger need them are:

 1. set separator - this can be done with standard counterpart
 2. ES6 port: this was done to allow importing as _t, but is
    unnecessary with the _t wrapper function in react-sdk
    (although also seems to work fine with
    `import _t from 'counterpart';`)
 3. Fallback to key name: unnecessary with
    `setMissingEntryGenerator` in 0.18, but we've changed to just
    using a fallback locale anyway since No code missing en
    translations should ever make it to the devbelop branch.
 4. Logging on missing translations. Unnecessary with
    `onTranslationNotFound`, but now not used anyway because we
    let missing translations show up in the UI as
    'missing translation'

Bulk changes to imports coming in separate commit for easy reading.
2017-05-25 11:24:17 +01:00