]> granicus.if.org Git - ejabberd/commitdiff
Fix UTF-8 support in translation files
authorEvgeny Khramtsov <ekhramtsov@process-one.net>
Wed, 24 Jul 2019 08:34:40 +0000 (11:34 +0300)
committerEvgeny Khramtsov <ekhramtsov@process-one.net>
Wed, 24 Jul 2019 08:34:40 +0000 (11:34 +0300)
28 files changed:
priv/msgs/ca.msg
priv/msgs/cs.msg
priv/msgs/de.msg
priv/msgs/el.msg
priv/msgs/eo.msg
priv/msgs/es.msg
priv/msgs/fr.msg
priv/msgs/gl.msg
priv/msgs/he.msg
priv/msgs/id.msg
priv/msgs/it.msg
priv/msgs/ja.msg
priv/msgs/nl.msg
priv/msgs/no.msg
priv/msgs/pl.msg
priv/msgs/pt-br.msg
priv/msgs/pt.msg
priv/msgs/ru.msg
priv/msgs/sk.msg
priv/msgs/sv.msg
priv/msgs/th.msg
priv/msgs/tr.msg
priv/msgs/uk.msg
priv/msgs/vi.msg
priv/msgs/wa.msg
priv/msgs/zh.msg
src/translate.erl
tools/prepare-tr.sh

index 44f4e196be58a1f77c50f49f3b9fdf76764e09cf..12c1ccfcdf9b5658fc6cdd1d1d873921e403ce1d 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {" (Add * to the end of field to match substring)"," (Afegix * al final d'un camp per a buscar subcadenes)"}.
 {" has set the subject to: "," ha posat l'assumpte: "}.
 {"A password is required to enter this room","Es necessita contrasenya per a entrar en aquesta sala"}.
index 8fdda6da61c1a935e22d75817e0f657e8ffac63a..15b38bd4c8b83200f6627aab818a6a176748e527 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Přijmout"}.
 {"Access denied by service policy","Přístup byl zamítnut nastavením služby"}.
 {"Action on user","Akce aplikovaná na uživatele"}.
index eb521390416452ef25f0b16afc7a160471ad2165..71d7b5037353d0c6af33186637464f62c08b82aa 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Akzeptieren"}.
 {"Access denied by service policy","Zugang aufgrund der Dienstrichtlinien verweigert"}.
 {"Action on user","Aktion auf Benutzer"}.
index 5000f448e13167185ba2476b34bf8e32a46cbf59..cf37295b9dfda73025adac64656050d2f1291dbe 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Αποδοχή"}.
 {"Access denied by service policy","Άρνηση πρόσβασης, λόγω τακτικής παροχής υπηρεσιών"}.
 {"Action on user","Eνέργεια για το χρήστη"}.
index f86c80148330644dad8004b530863e4b10c34ade..3df4c8802e0a9603673607b52d6be42e81598824 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Atingo rifuzita de serv-politiko"}.
 {"Action on user","Ago je uzanto"}.
 {"Add Jabber ID","Aldonu Jabber ID"}.
index 1092cb1ae8f12a57c03708f2bcdcb21b547a6ab4..dee284701fc72e1fcb1cc3ac5693f56833c382bb 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {" (Add * to the end of field to match substring)","(Añade * al final del campo para buscar subcadenas)"}.
 {" has set the subject to: "," ha puesto el asunto: "}.
 {"A password is required to enter this room"," (Añade * al final del campo para buscar subcadenas)"}.
index 205cb38c8f6d03a419858f3895ed43d93489bcbb..0de02d5cceb0c846f7dcbdf535f9b1196d0ad728 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Accepter"}.
 {"Access denied by service policy","L'accès au service est refusé"}.
 {"Action on user","Action sur l'utilisateur"}.
index 87edae308ce3315558520ffc4045e2eb5413c045..20ef0089032a3cd419eb6f766d43ba1095e7df05 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Aceptar"}.
 {"Access denied by service policy","Acceso denegado pola política do servizo"}.
 {"Action on user","Acción no usuario"}.
index b751a0b4f2b1b5cc33cdf6938923d3539671faa8..b9625ca54077ef2b9e0f15b445c86d5517e3d0e4 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","קבל"}.
 {"Access denied by service policy","גישה נדחתה על ידי פוליסת שירות"}.
 {"Action on user","פעולה על משתמש"}.
index a3b9c7b89f7ce4a8746b56e2e7cfc73e16c7b82d..7fc84b8fb4645b25b107af6fb02dd6e2623ee797 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Akses ditolak oleh kebijakan layanan"}.
 {"Action on user","Tindakan pada pengguna"}.
 {"Add Jabber ID","Tambah Jabber ID"}.
index d98e2c61dfe120290090b8d4e3b06c5150fe5f09..d9855c8af0e586bcddbd58074f6a3d68355260b7 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Accesso impedito dalle politiche del servizio"}.
 {"Action on user","Azione sull'utente"}.
 {"Add Jabber ID","Aggiungere un Jabber ID (Jabber ID)"}.
index fd8065aa6a7423e3bc5adee4d80517d843679a47..a2882ace586edbb088441d8f65d8b5e2a9d9cfda 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","許可"}.
 {"Access denied by service policy","サービスポリシーによってアクセスが禁止されました"}.
 {"Action on user","ユーザー操作"}.
index caae045a8aae89f52b266d4e0c4de5bfb70807af..8009d529ff6fc7f71b730fdcdc52750fe7ca3ac1 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","De toegang werd geweigerd door het beleid van deze dienst"}.
 {"Action on user","Actie op gebruiker"}.
 {"Add Jabber ID","Jabber ID toevoegen"}.
index 2a91225967b48e5ee6b7416cfadda7e0025ea626..bd40f4b07cd11240fcf1317be73daf2643a8d5fb 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Tilgang nektes på grunn av en tjeneste regel"}.
 {"Action on user","Handling på bruker"}.
 {"Add Jabber ID","Legg til Jabber ID"}.
index d720683dc8206e79190688ad8c4fdcc987b92ce5..2ca75b259c0c12aa8041dcdbf416d48d3484c329 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Zaakceptuj"}.
 {"Access denied by service policy","Dostęp zabroniony zgodnie z zasadami usługi"}.
 {"Action on user","Wykonaj na użytkowniku"}.
index b353d4b67895c1559d4de9ec6643bbe7365e564b..47255063e9764bdc59708ea03346427af5df8dbd 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Aceito"}.
 {"Access denied by service policy","Acesso negado pela política do serviço"}.
 {"Action on user","Ação no usuário"}.
index 2581294fdf81d1ed7e5ecf1e9e3accf56ddb1053..6c9ccef6440d327619131092ec4ed994f4d9a71d 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Acesso negado pela política de serviço"}.
 {"Action on user","Acção no utilizador"}.
 {"Add New","Adicionar novo"}.
index 82a21a0e28280170f90228599d005862ffd04021..f7dff97ea14fb2ca8ed853d8ce254542d42146fe 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Принять"}.
 {"Access denied by service policy","Доступ запрещён политикой службы"}.
 {"Account doesn't exist","Учётная запись не существует"}.
index c8e1618866b97475a526816cba95f6e16b13cf73..af1c7d1ca41f25d90b1b7840a7572af0f0c1d368 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Prístup bol zamietnutý nastavením služby"}.
 {"Action on user","Operácia aplikovaná na užívateľa"}.
 {"Add Jabber ID","Pridať Jabber ID"}.
index 3ef33c366f03af1eadcb9afdab1845c0ccd04dc2..472c4f901f2432e3b8c1ca34de16cd09d333969a 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Åtkomst nekad enligt lokal policy"}.
 {"Action on user","Handling mot användare"}.
 {"Add Jabber ID","Lägg till Jabber ID"}.
index cd41a4015c1753f765af813a3f2a88fb5a97e8f5..190e861e630e95d6a0453270082608b047ed6b30 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","การเข้าถึงถูกปฏิเสธโดยนโยบายการบริการ"}.
 {"Action on user","การดำเนินการกับผู้ใช้"}.
 {"Add Jabber ID","เพิ่ม Jabber ID"}.
index 784aaa54b925b80acb56733f15990df9aaaab06f..73478501e2552c49adb5a2dfa9648d546ee6550a 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Servis politikası gereği erişim engellendi"}.
 {"Action on user","Kullanıcıya uygulanacak eylem"}.
 {"Add Jabber ID","Jabber ID'si Ekle"}.
index 98866cf5177bde88403071e4fad8f6b2fa3be266..0fbc336d51edb0baee98714498bab703f4452a7f 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Прийняти"}.
 {"Access denied by service policy","Доступ заборонений політикою служби"}.
 {"Action on user","Дія над користувачем"}.
index 360ac7d9f5a437a4568896b9558ee039f6376b54..e270f1cac3d09b96f8c64fe7392ede07621c934f 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Access denied by service policy","Sự truy cập bị chặn theo chính sách phục vụ"}.
 {"Action on user","Hành động đối với người sử dụng"}.
 {"Add Jabber ID","Thêm Jabber ID"}.
index 69fc6552e4a64773c75f79f57c9a88a0e4c1738d..ca1428fde1277f7c1ed7ea577472a93b500eacdc 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","Accepter"}.
 {"Access denied by service policy","L' accès a stî rfuzé pal politike do siervice"}.
 {"Action on user","Accion so l' uzeu"}.
index 7eeb7163725244ab0485931c3294ae59e41b8622..4ea90903124fceab60c53c8835c099aaa82b72db 100644 (file)
@@ -1,4 +1,4 @@
-%% -*- coding: latin-1 -*-
+%% -*- coding: utf-8 -*-
 {"Accept","接受"}.
 {"Access denied by service policy","访问被服务策略拒绝"}.
 {"Action on user","对用户的动作"}.
index 72028e60a3fed39528734e7e89922294827e3e1a..11237114c4a4bdd311c9662e5bb36070b2245e10 100644 (file)
@@ -145,12 +145,12 @@ load(Files, Dir) ->
                                     {error, file:filename(), error_reason()}].
 load_file(File) ->
     Lang = lang_of_file(File),
-    case file:consult(File) of
+    try file:consult(File) of
        {ok, Lines} ->
            lists:map(
              fun({In, Out}) ->
-                     try {unicode:characters_to_binary(In, utf8),
-                          unicode:characters_to_binary(Out, utf8)} of
+                     try {unicode:characters_to_binary(In),
+                          unicode:characters_to_binary(Out)} of
                          {InB, OutB} when is_binary(InB), is_binary(OutB) ->
                              {{Lang, InB}, OutB};
                          _ ->
@@ -163,6 +163,11 @@ load_file(File) ->
              end, Lines);
        {error, Reason} ->
            [{error, File, Reason}]
+    catch _:{case_clause, {error, _}} ->
+           %% At the moment of the writing there was a bug in
+           %% file:consult_stream/3 - it doesn't process {error, term()}
+           %% result from io:read/3
+           [{error, File, bad_file}]
     end.
 
 -spec translate(binary(), binary()) -> binary().
@@ -299,7 +304,7 @@ lang_of_file(FileName) ->
 format_error(bad_file) ->
     "corrupted or invalid translation file";
 format_error(bad_encoding) ->
-    "not an UTF-8 encoding";
+    "cannot translate from UTF-8";
 format_error({_, _, _} = Reason) ->
     "at line " ++ file:format_error(Reason);
 format_error(Reason) ->
index 2d39aaf595952a42b4dc40cc9797a45ca41eb073..d8f7753a616fa939accf598cd4eec8ba7873cf7b 100755 (executable)
@@ -48,7 +48,7 @@ extract_lang_po2msg ()
        msgattrib $PO_PATH --translated --no-fuzzy --no-obsolete --no-location --no-wrap | grep "^msg" | tail --lines=+3 >$MS_PATH
        grep "^msgid" $PO_PATH.ms | sed 's/^msgid //g' >$MSGID_PATH
        grep "^msgstr" $PO_PATH.ms | sed 's/^msgstr //g' >$MSGSTR_PATH
-       echo "%% -*- coding: latin-1 -*-" >$MSGS_PATH
+       echo "%% -*- coding: utf-8 -*-" >$MSGS_PATH
        paste $MSGID_PATH $MSGSTR_PATH --delimiter=, | awk '{print "{" $0 "}."}' | sort -g >>$MSGS_PATH
 
        rm $MS_PATH