diff --git a/priv/msgs/ca.msg b/priv/msgs/ca.msg index 44f4e196b..12c1ccfcd 100644 --- a/priv/msgs/ca.msg +++ b/priv/msgs/ca.msg @@ -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"}. diff --git a/priv/msgs/cs.msg b/priv/msgs/cs.msg index 8fdda6da6..15b38bd4c 100644 --- a/priv/msgs/cs.msg +++ b/priv/msgs/cs.msg @@ -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"}. diff --git a/priv/msgs/de.msg b/priv/msgs/de.msg index eb5213904..71d7b5037 100644 --- a/priv/msgs/de.msg +++ b/priv/msgs/de.msg @@ -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"}. diff --git a/priv/msgs/el.msg b/priv/msgs/el.msg index 5000f448e..cf37295b9 100644 --- a/priv/msgs/el.msg +++ b/priv/msgs/el.msg @@ -1,4 +1,4 @@ -%% -*- coding: latin-1 -*- +%% -*- coding: utf-8 -*- {"Accept","Αποδοχή"}. {"Access denied by service policy","Άρνηση πρόσβασης, λόγω τακτικής παροχής υπηρεσιών"}. {"Action on user","Eνέργεια για το χρήστη"}. diff --git a/priv/msgs/eo.msg b/priv/msgs/eo.msg index f86c80148..3df4c8802 100644 --- a/priv/msgs/eo.msg +++ b/priv/msgs/eo.msg @@ -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"}. diff --git a/priv/msgs/es.msg b/priv/msgs/es.msg index 1092cb1ae..dee284701 100644 --- a/priv/msgs/es.msg +++ b/priv/msgs/es.msg @@ -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)"}. diff --git a/priv/msgs/fr.msg b/priv/msgs/fr.msg index 205cb38c8..0de02d5cc 100644 --- a/priv/msgs/fr.msg +++ b/priv/msgs/fr.msg @@ -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"}. diff --git a/priv/msgs/gl.msg b/priv/msgs/gl.msg index 87edae308..20ef00890 100644 --- a/priv/msgs/gl.msg +++ b/priv/msgs/gl.msg @@ -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"}. diff --git a/priv/msgs/he.msg b/priv/msgs/he.msg index b751a0b4f..b9625ca54 100644 --- a/priv/msgs/he.msg +++ b/priv/msgs/he.msg @@ -1,4 +1,4 @@ -%% -*- coding: latin-1 -*- +%% -*- coding: utf-8 -*- {"Accept","קבל"}. {"Access denied by service policy","גישה נדחתה על ידי פוליסת שירות"}. {"Action on user","פעולה על משתמש"}. diff --git a/priv/msgs/id.msg b/priv/msgs/id.msg index a3b9c7b89..7fc84b8fb 100644 --- a/priv/msgs/id.msg +++ b/priv/msgs/id.msg @@ -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"}. diff --git a/priv/msgs/it.msg b/priv/msgs/it.msg index d98e2c61d..d9855c8af 100644 --- a/priv/msgs/it.msg +++ b/priv/msgs/it.msg @@ -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)"}. diff --git a/priv/msgs/ja.msg b/priv/msgs/ja.msg index fd8065aa6..a2882ace5 100644 --- a/priv/msgs/ja.msg +++ b/priv/msgs/ja.msg @@ -1,4 +1,4 @@ -%% -*- coding: latin-1 -*- +%% -*- coding: utf-8 -*- {"Accept","許可"}. {"Access denied by service policy","サービスポリシーによってアクセスが禁止されました"}. {"Action on user","ユーザー操作"}. diff --git a/priv/msgs/nl.msg b/priv/msgs/nl.msg index caae045a8..8009d529f 100644 --- a/priv/msgs/nl.msg +++ b/priv/msgs/nl.msg @@ -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"}. diff --git a/priv/msgs/no.msg b/priv/msgs/no.msg index 2a9122596..bd40f4b07 100644 --- a/priv/msgs/no.msg +++ b/priv/msgs/no.msg @@ -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"}. diff --git a/priv/msgs/pl.msg b/priv/msgs/pl.msg index d720683dc..2ca75b259 100644 --- a/priv/msgs/pl.msg +++ b/priv/msgs/pl.msg @@ -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"}. diff --git a/priv/msgs/pt-br.msg b/priv/msgs/pt-br.msg index b353d4b67..47255063e 100644 --- a/priv/msgs/pt-br.msg +++ b/priv/msgs/pt-br.msg @@ -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"}. diff --git a/priv/msgs/pt.msg b/priv/msgs/pt.msg index 2581294fd..6c9ccef64 100644 --- a/priv/msgs/pt.msg +++ b/priv/msgs/pt.msg @@ -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"}. diff --git a/priv/msgs/ru.msg b/priv/msgs/ru.msg index 82a21a0e2..f7dff97ea 100644 --- a/priv/msgs/ru.msg +++ b/priv/msgs/ru.msg @@ -1,4 +1,4 @@ -%% -*- coding: latin-1 -*- +%% -*- coding: utf-8 -*- {"Accept","Принять"}. {"Access denied by service policy","Доступ запрещён политикой службы"}. {"Account doesn't exist","Учётная запись не существует"}. diff --git a/priv/msgs/sk.msg b/priv/msgs/sk.msg index c8e161886..af1c7d1ca 100644 --- a/priv/msgs/sk.msg +++ b/priv/msgs/sk.msg @@ -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"}. diff --git a/priv/msgs/sv.msg b/priv/msgs/sv.msg index 3ef33c366..472c4f901 100644 --- a/priv/msgs/sv.msg +++ b/priv/msgs/sv.msg @@ -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"}. diff --git a/priv/msgs/th.msg b/priv/msgs/th.msg index cd41a4015..190e861e6 100644 --- a/priv/msgs/th.msg +++ b/priv/msgs/th.msg @@ -1,4 +1,4 @@ -%% -*- coding: latin-1 -*- +%% -*- coding: utf-8 -*- {"Access denied by service policy","การเข้าถึงถูกปฏิเสธโดยนโยบายการบริการ"}. {"Action on user","การดำเนินการกับผู้ใช้"}. {"Add Jabber ID","เพิ่ม Jabber ID"}. diff --git a/priv/msgs/tr.msg b/priv/msgs/tr.msg index 784aaa54b..73478501e 100644 --- a/priv/msgs/tr.msg +++ b/priv/msgs/tr.msg @@ -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"}. diff --git a/priv/msgs/uk.msg b/priv/msgs/uk.msg index 98866cf51..0fbc336d5 100644 --- a/priv/msgs/uk.msg +++ b/priv/msgs/uk.msg @@ -1,4 +1,4 @@ -%% -*- coding: latin-1 -*- +%% -*- coding: utf-8 -*- {"Accept","Прийняти"}. {"Access denied by service policy","Доступ заборонений політикою служби"}. {"Action on user","Дія над користувачем"}. diff --git a/priv/msgs/vi.msg b/priv/msgs/vi.msg index 360ac7d9f..e270f1cac 100644 --- a/priv/msgs/vi.msg +++ b/priv/msgs/vi.msg @@ -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"}. diff --git a/priv/msgs/wa.msg b/priv/msgs/wa.msg index 69fc6552e..ca1428fde 100644 --- a/priv/msgs/wa.msg +++ b/priv/msgs/wa.msg @@ -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"}. diff --git a/priv/msgs/zh.msg b/priv/msgs/zh.msg index 7eeb71637..4ea909031 100644 --- a/priv/msgs/zh.msg +++ b/priv/msgs/zh.msg @@ -1,4 +1,4 @@ -%% -*- coding: latin-1 -*- +%% -*- coding: utf-8 -*- {"Accept","接受"}. {"Access denied by service policy","访问被服务策略拒绝"}. {"Action on user","对用户的动作"}. diff --git a/src/translate.erl b/src/translate.erl index 72028e60a..11237114c 100644 --- a/src/translate.erl +++ b/src/translate.erl @@ -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) -> diff --git a/tools/prepare-tr.sh b/tools/prepare-tr.sh index 2d39aaf59..d8f7753a6 100755 --- a/tools/prepare-tr.sh +++ b/tools/prepare-tr.sh @@ -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