Fix UTF-8 support in translation files

This commit is contained in:
Evgeny Khramtsov 2019-07-24 11:34:40 +03:00
parent 052917961a
commit 9ef52f2b0f
28 changed files with 36 additions and 31 deletions

View 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"}.

View 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"}.

View 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"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*-
%% -*- coding: utf-8 -*-
{"Accept","Αποδοχή"}.
{"Access denied by service policy","Άρνηση πρόσβασης, λόγω τακτικής παροχής υπηρεσιών"}.
{"Action on user","Eνέργεια για το χρήστη"}.

View 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"}.

View 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)"}.

View 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"}.

View 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"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*-
%% -*- coding: utf-8 -*-
{"Accept","קבל"}.
{"Access denied by service policy","גישה נדחתה על ידי פוליסת שירות"}.
{"Action on user","פעולה על משתמש"}.

View 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"}.

View 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)"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*-
%% -*- coding: utf-8 -*-
{"Accept","許可"}.
{"Access denied by service policy","サービスポリシーによってアクセスが禁止されました"}.
{"Action on user","ユーザー操作"}.

View 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"}.

View 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"}.

View 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"}.

View 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"}.

View 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"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*-
%% -*- coding: utf-8 -*-
{"Accept","Принять"}.
{"Access denied by service policy","Доступ запрещён политикой службы"}.
{"Account doesn't exist","Учётная запись не существует"}.

View 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"}.

View 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"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*-
%% -*- coding: utf-8 -*-
{"Access denied by service policy","การเข้าถึงถูกปฏิเสธโดยนโยบายการบริการ"}.
{"Action on user","การดำเนินการกับผู้ใช้"}.
{"Add Jabber ID","เพิ่ม Jabber ID"}.

View 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"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*-
%% -*- coding: utf-8 -*-
{"Accept","Прийняти"}.
{"Access denied by service policy","Доступ заборонений політикою служби"}.
{"Action on user","Дія над користувачем"}.

View 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"}.

View 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"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*-
%% -*- coding: utf-8 -*-
{"Accept","接受"}.
{"Access denied by service policy","访问被服务策略拒绝"}.
{"Action on user","对用户的动作"}.

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

View File

@ -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