Skip to content

Commit 8216d89

Browse files
author
Weblate
committed
Merge branch 'develop' of https://github.com/vector-im/riot-web into develop
Conflicts: src/i18n/strings/cs.json src/i18n/strings/fr.json src/i18n/strings/nb_NO.json src/i18n/strings/nl.json src/i18n/strings/pt_BR.json
2 parents 7d12e2f + e405d6c commit 8216d89

48 files changed

Lines changed: 168 additions & 504 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎config.sample.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"integrations_rest_url": "https://scalar.vector.im/api",
77
"bug_report_endpoint_url": "https://riot.im/bugreports/submit",
88
"enableLabs": true,
9+
"default_federate": true,
910
"roomDirectory": {
1011
"servers": [
1112
"matrix.org"

‎docs/translating-dev.md‎

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,30 @@
66
- Be able to understand English
77
- Be able to understand the language you want to translate riot-web into
88

9+
## Translating strings vs. marking strings for translation
10+
11+
Translating strings are done with the `_t()` function found in matrix-react-sdk/lib/languageHandler.js. It is recommended to call this function wherever you introduce a string constant which should be translated. However, translating can not be performed until after the translation system has been initialized. Thus, sometimes translation must be performed at a different location in the source code than where the string is introduced. This breaks some tooling and makes it difficult to find translatable strings. Therefore, there is the alternative `_td()` function which is used to mark strings for translation, without actually performing the translation (which must still be performed separately, and after the translation system has been initialized).
12+
13+
Basically, whenever a translatable string is introduced, you should call either `_t()` immediately OR `_td()` and later `_t()`.
14+
15+
Example:
16+
```
17+
// Module-level constant
18+
const COLORS = {
19+
'#f8481c': _td('reddish orange'), // Can't call _t() here yet
20+
'#fc2647': _td('pinky red') // Use _td() instead so the text is picked up for translation anyway
21+
}
22+
23+
// Function that is called some time after i18n has been loaded
24+
function getColorName(hex) {
25+
return _t(COLORS[hex]); // Perform actual translation here
26+
}
27+
```
28+
929
## Adding new strings
1030

11-
1. Check if the import ``import { _t } from 'matrix-react-sdk/lib/languageHandler';`` is present. If not add it to the other import statements.
12-
2. Add ``_t()`` to your string. (Don't forget curly braces when you assign an expression to JSX attributes in the render method)
31+
1. Check if the import ``import { _t } from 'matrix-react-sdk/lib/languageHandler';`` is present. If not add it to the other import statements. Also import `_td` if needed.
32+
2. Add ``_t()`` to your string. (Don't forget curly braces when you assign an expression to JSX attributes in the render method). If the string is introduced at a point before the translation system has not yet been initialized, use `_td()` instead, and call `_t()` at the appropriate time.
1333
3. Add the String to the ``en_EN.json`` file in ``src/i18n/strings`` (respect which repository you are on).
1434

1535
## Adding variables inside a string.
@@ -21,6 +41,8 @@
2141

2242
## Things to know/Style Guides
2343

24-
- Do not use it inside ``getDefaultProps`` at the point where ``getDefaultProps`` is initialized the translations aren't loaded yet and it causes missing translations.
25-
- If using translated strings as constants, translated strings can't be in constants loaded at class-load time since the translations won't be loaded.
44+
- Do not use `_t()` inside ``getDefaultProps``: the translations aren't loaded when `getDefaultProps` is called, leading to missing translations. Use `_td()` to indicate that `_t()` will be called on the string later.
45+
- If using translated strings as constants, translated strings can't be in constants loaded at class-load time since the translations won't be loaded. Mark the strings using `_td()` instead and perform the actual translation later.
2646
- If a string is presented in the UI with punctuation like a full stop, include this in the translation strings, since punctuation varies between languages too.
47+
- Avoid "translation in parts", i.e. concatenating translated strings or using translated strings in variable substitutions. Context is important for translations, and translating partial strings this way is simply not always possible.
48+
- Concatenating strings often also introduces an implicit assumption about word order (e.g. that the subject of the sentence comes first), which is incorrect for many languages.

‎scripts/copy-res.js‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -160,10 +160,15 @@ function genLangFile(lang, dest) {
160160
let translations = {};
161161
[reactSdkFile, riotWebFile].forEach(function(f) {
162162
if (fs.existsSync(f)) {
163-
Object.assign(
164-
translations,
165-
JSON.parse(fs.readFileSync(f).toString())
166-
);
163+
try {
164+
Object.assign(
165+
translations,
166+
JSON.parse(fs.readFileSync(f).toString())
167+
);
168+
} catch (e) {
169+
console.error("Failed: "+f, e);
170+
throw e;
171+
}
167172
}
168173
});
169174

‎src/components/structures/RoomSubList.js‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ var RoomSubList = React.createClass({
536536
var label = this.props.collapsed ? null : this.props.label;
537537

538538
let content;
539-
if (this.state.sortedList.length == 0 && !this.props.searchFilter && !this.props.extraTiles) {
539+
if (this.state.sortedList.length === 0 && !this.props.searchFilter && this.props.extraTiles.length === 0) {
540540
content = this.props.emptyContent;
541541
} else {
542542
content = this.makeRoomTiles();

‎src/components/views/context_menus/RoomTileContextMenu.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Promise from 'bluebird';
2121
import React from 'react';
2222
import classNames from 'classnames';
2323
import sdk from 'matrix-react-sdk';
24-
import { _t } from 'matrix-react-sdk/lib/languageHandler';
24+
import { _t, _td } from 'matrix-react-sdk/lib/languageHandler';
2525
import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
2626
import dis from 'matrix-react-sdk/lib/dispatcher';
2727
import DMRoomMap from 'matrix-react-sdk/lib/utils/DMRoomMap';
@@ -185,7 +185,7 @@ module.exports = React.createClass({
185185
MatrixClientPeg.get().forget(this.props.room.roomId).done(function() {
186186
dis.dispatch({ action: 'view_next_room' });
187187
}, function(err) {
188-
var errCode = err.errcode || "unknown error code";
188+
var errCode = err.errcode || _td("unknown error code");
189189
var ErrorDialog = sdk.getComponent("dialogs.ErrorDialog");
190190
Modal.createTrackedDialog('Failed to forget room', '', ErrorDialog, {
191191
title: _t('Failed to forget room %(errCode)s', {errCode: errCode}),

‎src/i18n/strings/ar.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
"Collapse panel": "طي الجدول",
2121
"Collecting app version information": "إستعادة معلومات النسخة للتطبيق",
2222
"Collecting logs": "إستعادة السجلات",
23-
"Create new room": "إنشاء غرفة جديدة",
2423
"Couldn't find a matching Matrix room": "لا يمكن إيجاد غرفة مايتركس متطابقة",
2524
"Custom Server Options": "إعدادات السيرفر خاصة",
2625
"delete the alias.": "إلغاء المُعرف.",

‎src/i18n/strings/be.json‎

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
"Cancel Sending": "Адмяніць адпраўку",
88
"Can't update user notification settings": "Немагчыма абнавіць налады апавяшчэнняў карыстальніка",
99
"Close": "Зачыніць",
10-
"Create new room": "Стварыць новы пакой",
1110
"Couldn't find a matching Matrix room": "Не атрымалася знайсці адпаведны пакой Matrix",
1211
"Custom Server Options": "Карыстальніцкія параметры сервера",
1312
"delete the alias.": "выдаліць псеўданім.",
@@ -16,7 +15,6 @@
1615
"Directory": "Каталог",
1716
"Dismiss": "Aдхіліць",
1817
"Download this file": "Спампаваць гэты файл",
19-
"Drop here %(toAction)s": "Перацягнуць сюды %(toAction)s",
2018
"Enable audible notifications in web client": "Ўключыць гукавыя апавяшчэнні ў вэб-кліенце",
2119
"Enable desktop notifications": "Ўключыць апавяшчэнні на працоўным стале",
2220
"Enable email notifications": "Ўключыць паведамлення па электроннай пошце",
@@ -26,14 +24,12 @@
2624
"Error": "Памылка",
2725
"Error saving email notification preferences": "Памылка захавання налад апавяшчэнняў па электроннай пошце",
2826
"#example": "#прыклад",
29-
"Failed to": "Не атрымалася",
3027
"Failed to add tag %(tagName)s to room": "Не атрымалася дадаць %(tagName)s ў пакоі",
3128
"Failed to change settings": "Не атрымалася змяніць налады",
3229
"Failed to forget room %(errCode)s": "Не атрымалася забыць пакой %(errCode)s",
3330
"Failed to update keywords": "Не атрымалася абнавіць ключавыя словы",
3431
"Failed to get protocol list from Home Server": "Не ўдалося атрымаць спіс пратаколаў ад хатняга сервера",
3532
"Failed to get public room list": "Не ўдалося атрымаць спіс агульных пакояў",
36-
"Failed to join the room": "Не ўдалося далучыцца да пакоя",
3733
"Failed to remove tag %(tagName)s from room": "Не ўдалося выдаліць %(tagName)s з пакоя",
3834
"Failed to set direct chat tag": "Не ўдалося ўсталяваць тэг прамога чата",
3935
"Failed to set Direct Message status of room": "Не ўдалося ўсталяваць статут прамога паведамлення пакою",
@@ -42,9 +38,7 @@
4238
"Files": "Файлы",
4339
"Filter room names": "Фільтр iмёнаў пакояў",
4440
"Forget": "Забыць",
45-
" from room": " з пакоя",
4641
"Guests can join": "Госці могуць далучыцца",
47-
"Guest users can't invite users. Please register to invite.": "Госцi не могуць запрашаць карыстальнікаў. Калі ласка, зарэгіструйцеся, каб запрасiць.",
4842
"Invite to this room": "Запрасіць у гэты пакой",
4943
"Keywords": "Ключавыя словы",
5044
"Leave": "Пакінуць",
@@ -63,7 +57,6 @@
6357
"On": "Уключыць",
6458
"Operation failed": "Не атрымалася выканаць аперацыю",
6559
"Permalink": "Пастаянная спасылка",
66-
"Please Register": "Калі ласка, зарэгіструйцеся",
6760
"powered by Matrix": "працуе на Matrix",
6861
"Quote": "Цытата",
6962
"Redact": "Адрэдагаваць",
@@ -74,15 +67,10 @@
7467
"Remove from Directory": "Выдалiць з каталога",
7568
"Resend": "Паўторна",
7669
"Riot does not know how to join a room on this network": "Riot не ведае, як увайсці ў пакой у гэтай сетке",
77-
"Room directory": "Каталог пакояў",
7870
"Room not found": "Пакой не знойдзены",
7971
"Search for a room": "Пошук па пакоі",
80-
"Settings": "Налады",
8172
"Source URL": "URL-адрас крыніцы",
82-
"Start chat": "Пачаць чат",
8373
"The Home Server may be too old to support third party networks": "Хатні сервер можа быць занадта стары для падтрымкі іншых сетак",
8474
"There are advanced notifications which are not shown here": "Ёсць пашыраныя апавяшчэння, якія не паказаныя тут",
85-
"The server may be unavailable or overloaded": "Сервер можа быць недаступны ці перагружаны",
86-
"This room is inaccessible to guests. You may be able to join if you register.": "Гэты пакой недаступны для гасцей. Вы можаце далучыцца, калі вы зарэгіструецеся.",
87-
" to room": " ў пакоі"
75+
"The server may be unavailable or overloaded": "Сервер можа быць недаступны ці перагружаны"
8876
}

‎src/i18n/strings/ca.json‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,10 @@
77
"Failed to change password. Is your password correct?": "Hi ha hagut un error al canviar la vostra contrasenya. És correcte la vostra contrasenya?",
88
"Continue": "Continua",
99
"All Rooms": "Totes les sales",
10-
"Create new room": "Crea una nova sala",
1110
"Couldn't find a matching Matrix room": "No s'ha pogut trobar una sala de Matrix que coincideixi",
1211
"Failed to add tag %(tagName)s to room": "No s'ha pogut afegir l'etiqueta %(tagName)s a la sala",
1312
"Failed to forget room %(errCode)s": "No s'ha pogut oblidar la sala %(errCode)s",
1413
"Failed to get public room list": "No s'ha pogut obtenir el llistat de sales públiques",
15-
"Failed to join the room": "No s'ha pogut unir a la sala",
1614
"Failed to remove tag %(tagName)s from room": "No s'ha pogut esborrar l'etiqueta %(tagName)s de la sala",
1715
"Filter room names": "Filtra els noms de les sales",
1816
"Couldn't load home page": "No s'ha pogut carregar la pàgina d'inici",
@@ -22,15 +20,12 @@
2220
"Direct Chat": "Xat directe",
2321
"Directory": "Directori",
2422
"Failed to set direct chat tag": "No s'ha pogut establir l'etiqueta del xat directe",
25-
"Room directory": "Directori de sales",
26-
"Start chat": "Inicia un xat",
2723
"Invite to this room": "Convida a aquesta sala",
2824
"No rooms to show": "No hi ha sales a mostrar",
2925
"Riot does not know how to join a room on this network": "El Riot no sap com unir-se a una sala en aquesta xarxa",
3026
"Room not found": "No s'ha trobat la sala",
3127
"Unnamed room": "Sala sense nom",
3228
"#example": "#exemple",
33-
"Settings": "Paràmetres",
3429
"Failed to change settings": "No s'han pogut modificar els paràmetres",
3530
"Enable audible notifications in web client": "Habilita les notificacions d'àudio al client web",
3631
"Enable desktop notifications": "Habilita les notificacions d'escriptori",
@@ -85,7 +80,6 @@
8580
"Source URL": "URL origen",
8681
"The server may be unavailable or overloaded": "El servidor pot no estar disponible o sobrecarregat",
8782
"This Room": "Aquesta sala",
88-
" to room": " a la sala",
8983
"Unavailable": "No disponible",
9084
"Unknown device": "Dispositiu desconegut",
9185
"unknown error code": "codi d'error desconegut",
@@ -110,7 +104,6 @@
110104
"Checking for an update...": "Comprovant si hi ha actualitzacions...",
111105
"No update available.": "No hi ha cap actualització disponible.",
112106
"Downloading update...": "Descarregant l'actualització...",
113-
"Welcome page": "Pàgina de benvinguda",
114107
"Welcome to Riot.im": "Benvingut a Riot.im",
115108
"Chat with Riot Bot": "Conversa amb el Bot de Riot",
116109
"Back": "Enrere",

‎src/i18n/strings/cs.json‎

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
"A new version of Riot is available.": "Je dostupná nová verze Riotu.",
55
"Notifications": "Upozornění",
66
"Search": "Hledání",
7-
"Settings": "Nastavení",
8-
"Create new room": "Založit novou místnost",
9-
"Room directory": "Adresář místností",
10-
"Start chat": "Začít chat",
117
"All Rooms": "Všechny místnosti",
128
"Files": "Soubory",
139
"Filter room names": "Filtrovat místnosti dle názvu",
@@ -30,10 +26,8 @@
3026
"Error": "Chyba",
3127
"Failed to change settings": "Nepodařilo se změnit nastavení",
3228
"Failed to get public room list": "Nepodařilo se získat seznam veřejných místností",
33-
"Failed to join the room": "Vstup do místnosti se nezdařil",
3429
"Favourite": "V oblíbených",
3530
"Guests can join": "Hosté mohou vstoupit",
36-
"Guest users can't invite users. Please register to invite.": "Hosté nemohou zvát uživatele. Zaregistrujte se a budete moci zvát.",
3731
"Hide panel": "Skrýt panel",
3832
"I understand the risks and wish to continue": "Rozumím rizikům a přeji si pokračovat",
3933
"Keywords": "Klíčová slova",
@@ -61,7 +55,6 @@
6155
"Please set a password!": "Prosím nastavte si heslo!",
6256
"You have successfully set a password!": "Úspěšně jste si nastavili heslo!",
6357
"Failed to change password. Is your password correct?": "Nepodařilo se změnit heslo. Je vaše heslo správné?",
64-
"Welcome page": "Uvítací stránka",
6558
"No update available.": "Není dostupná žádná aktualizace.",
6659
"Downloading update...": "Stahování aktualizace...",
6760
"Welcome to Riot.im": "Vítá vás Riot.im",
@@ -72,7 +65,6 @@
7265
"Off": "Vypnout",
7366
"On": "Zapnout",
7467
"Operation failed": "Chyba operace",
75-
"Please Register": "Zaregistrujte se prosím",
7668
"Remove %(name)s from the directory?": "Odebrat %(name)s z adresáře?",
7769
"Remove": "Odebrat",
7870
"remove %(name)s from the directory.": "odebrat %(name)s z adresáře.",
@@ -126,7 +118,6 @@
126118
"Failed to remove tag %(tagName)s from room": "Nepodařilo se odstranit štítek %(tagName)s z místnosti",
127119
"Failed to send report: ": "Nepodařilo se odeslat hlášení: ",
128120
"Forget": "Zapomenout",
129-
" from room": " z místnosti",
130121
"(HTTP status %(httpStatus)s)": "(HTTP status %(httpStatus)s)",
131122
"In order to diagnose problems, logs from this client will be sent with this bug report. If you would prefer to only send the text above, please untick:": "Kvůli diagnostice budou spolu s tímto hlášením o chybě odeslány i záznamy z klienta. Chcete-li odeslat pouze text výše, prosím odškrtněte:",
132123
"No rooms to show": "Žádné místnosti k zobrazení",
@@ -142,15 +133,12 @@
142133
"Riot uses many advanced browser features, some of which are not available or experimental in your current browser.": "Riot používá mnoho pokročilých funkcí, z nichž některé jsou ve vašem současném prohlížeči nedostupné nebo experimentální.",
143134
"Sorry, your browser is <b>not</b> able to run Riot.": "Omlouváme se, váš prohlížeč <b>není</b> schopný spustit Riot.",
144135
"There are advanced notifications which are not shown here": "Jsou k dispozici pokročilá upozornění, která zde nejsou zobrazena",
145-
"This room is inaccessible to guests. You may be able to join if you register.": "Tato místnost není přístupná hostům. Je třeba se nejprve registrovat.",
146-
" to room": " do místnosti",
147136
"Unhide Preview": "Zobrazit náhled",
148137
"Uploaded on %(date)s by %(user)s": "Nahráno %(date)s uživatelem %(user)s",
149138
"Uploading report": "Nahrávám hlášení",
150139
"View Decrypted Source": "Zobrazit dešifrovaný zdroj",
151140
"When I'm invited to a room": "Pokud jsem pozván do místnosti",
152141
"World readable": "Viditelné pro všechny",
153-
"You are Rioting as a guest. <a>Register</a> or <a>sign in</a> to access more rooms and features!": "Riotujete jako host. <a>Zaregistrujte se</a> nebo <a>se přihlašte</a> pro přístup k více místnostem a funkcím!",
154142
"You might have configured them in a client other than Riot. You cannot tune them in Riot but they still apply": "Snad jste je nastavili v jiném klientu než Riot. V Riotu je nemůžete upravit, ale přesto platí",
155143
"Error encountered (%(errorDetail)s).": "Nastala chyba (%(errorDetail)s).",
156144
"You need to be using HTTPS to place a screen-sharing call.": "Pro uskutečnění hovoru se sdílením obrazovky musíte používat HTTPS.",
@@ -171,7 +159,6 @@
171159
"Collapse panel": "Sbalit panel",
172160
"Dismiss": "Zahodit",
173161
"Expand panel": "Rozbalit panel",
174-
"Failed to": "Nepodařilo se",
175162
"Failed to set direct chat tag": "Nepodařilo se nastavit štítek přímého chatu",
176163
"Failed to set Direct Message status of room": "Nepodařilo se přiřadit místnosti status Přímé zprávy",
177164
"powered by Matrix": "poháněno Matrixem",
@@ -198,7 +185,6 @@
198185
"To return to your account in future you need to <u>set a password</u>": "Abyste se mohli ke svému účtu v budoucnu vrátit, musíte si <u>nastavit heslo</u>",
199186
"This will allow you to return to your account after signing out, and sign in on other devices.": "Toto vám umožní vrátit se po odhlášení ke svému účtu a používat jej na ostatních zařízeních.",
200187
"You can now return to your account after signing out, and sign in on other devices.": "Nyní se můžete ke svému účtu vrátit i po odhlášení a používat jej na ostatních zařízeních.",
201-
"Drop here %(toAction)s": "Přetažením sem %(toAction)s",
202188
"Fetching third party location failed": "Nepodařilo se zjistit umístění třetí strany",
203189
"Messages in one-to-one chats": "Zprávy v individuálních chatech",
204190
"Notification targets": "Cíle upozornění",

0 commit comments

Comments
 (0)