25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-24 17:29:28 +01:00

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)"}. {" (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: "}. {" 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"}. {"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"}. {"Accept","Přijmout"}.
{"Access denied by service policy","Přístup byl zamítnut nastavením služby"}. {"Access denied by service policy","Přístup byl zamítnut nastavením služby"}.
{"Action on user","Akce aplikovaná na uživatele"}. {"Action on user","Akce aplikovaná na uživatele"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Akzeptieren"}. {"Accept","Akzeptieren"}.
{"Access denied by service policy","Zugang aufgrund der Dienstrichtlinien verweigert"}. {"Access denied by service policy","Zugang aufgrund der Dienstrichtlinien verweigert"}.
{"Action on user","Aktion auf Benutzer"}. {"Action on user","Aktion auf Benutzer"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Αποδοχή"}. {"Accept","Αποδοχή"}.
{"Access denied by service policy","Άρνηση πρόσβασης, λόγω τακτικής παροχής υπηρεσιών"}. {"Access denied by service policy","Άρνηση πρόσβασης, λόγω τακτικής παροχής υπηρεσιών"}.
{"Action on user","Eνέργεια για το χρήστη"}. {"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"}. {"Access denied by service policy","Atingo rifuzita de serv-politiko"}.
{"Action on user","Ago je uzanto"}. {"Action on user","Ago je uzanto"}.
{"Add Jabber ID","Aldonu Jabber ID"}. {"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)"}. {" (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: "}. {" 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)"}. {"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"}. {"Accept","Accepter"}.
{"Access denied by service policy","L'accès au service est refusé"}. {"Access denied by service policy","L'accès au service est refusé"}.
{"Action on user","Action sur l'utilisateur"}. {"Action on user","Action sur l'utilisateur"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Aceptar"}. {"Accept","Aceptar"}.
{"Access denied by service policy","Acceso denegado pola política do servizo"}. {"Access denied by service policy","Acceso denegado pola política do servizo"}.
{"Action on user","Acción no usuario"}. {"Action on user","Acción no usuario"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","קבל"}. {"Accept","קבל"}.
{"Access denied by service policy","גישה נדחתה על ידי פוליסת שירות"}. {"Access denied by service policy","גישה נדחתה על ידי פוליסת שירות"}.
{"Action on user","פעולה על משתמש"}. {"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"}. {"Access denied by service policy","Akses ditolak oleh kebijakan layanan"}.
{"Action on user","Tindakan pada pengguna"}. {"Action on user","Tindakan pada pengguna"}.
{"Add Jabber ID","Tambah Jabber ID"}. {"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"}. {"Access denied by service policy","Accesso impedito dalle politiche del servizio"}.
{"Action on user","Azione sull'utente"}. {"Action on user","Azione sull'utente"}.
{"Add Jabber ID","Aggiungere un Jabber ID (Jabber ID)"}. {"Add Jabber ID","Aggiungere un Jabber ID (Jabber ID)"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","許可"}. {"Accept","許可"}.
{"Access denied by service policy","サービスポリシーによってアクセスが禁止されました"}. {"Access denied by service policy","サービスポリシーによってアクセスが禁止されました"}.
{"Action on user","ユーザー操作"}. {"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"}. {"Access denied by service policy","De toegang werd geweigerd door het beleid van deze dienst"}.
{"Action on user","Actie op gebruiker"}. {"Action on user","Actie op gebruiker"}.
{"Add Jabber ID","Jabber ID toevoegen"}. {"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"}. {"Access denied by service policy","Tilgang nektes på grunn av en tjeneste regel"}.
{"Action on user","Handling på bruker"}. {"Action on user","Handling på bruker"}.
{"Add Jabber ID","Legg til Jabber ID"}. {"Add Jabber ID","Legg til Jabber ID"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Zaakceptuj"}. {"Accept","Zaakceptuj"}.
{"Access denied by service policy","Dostęp zabroniony zgodnie z zasadami usługi"}. {"Access denied by service policy","Dostęp zabroniony zgodnie z zasadami usługi"}.
{"Action on user","Wykonaj na użytkowniku"}. {"Action on user","Wykonaj na użytkowniku"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Aceito"}. {"Accept","Aceito"}.
{"Access denied by service policy","Acesso negado pela política do serviço"}. {"Access denied by service policy","Acesso negado pela política do serviço"}.
{"Action on user","Ação no usuário"}. {"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"}. {"Access denied by service policy","Acesso negado pela política de serviço"}.
{"Action on user","Acção no utilizador"}. {"Action on user","Acção no utilizador"}.
{"Add New","Adicionar novo"}. {"Add New","Adicionar novo"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Принять"}. {"Accept","Принять"}.
{"Access denied by service policy","Доступ запрещён политикой службы"}. {"Access denied by service policy","Доступ запрещён политикой службы"}.
{"Account doesn't exist","Учётная запись не существует"}. {"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"}. {"Access denied by service policy","Prístup bol zamietnutý nastavením služby"}.
{"Action on user","Operácia aplikovaná na užívateľa"}. {"Action on user","Operácia aplikovaná na užívateľa"}.
{"Add Jabber ID","Pridať Jabber ID"}. {"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"}. {"Access denied by service policy","Åtkomst nekad enligt lokal policy"}.
{"Action on user","Handling mot användare"}. {"Action on user","Handling mot användare"}.
{"Add Jabber ID","Lägg till Jabber ID"}. {"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","การเข้าถึงถูกปฏิเสธโดยนโยบายการบริการ"}. {"Access denied by service policy","การเข้าถึงถูกปฏิเสธโดยนโยบายการบริการ"}.
{"Action on user","การดำเนินการกับผู้ใช้"}. {"Action on user","การดำเนินการกับผู้ใช้"}.
{"Add Jabber ID","เพิ่ม Jabber ID"}. {"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"}. {"Access denied by service policy","Servis politikası gereği erişim engellendi"}.
{"Action on user","Kullanıcıya uygulanacak eylem"}. {"Action on user","Kullanıcıya uygulanacak eylem"}.
{"Add Jabber ID","Jabber ID'si Ekle"}. {"Add Jabber ID","Jabber ID'si Ekle"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Прийняти"}. {"Accept","Прийняти"}.
{"Access denied by service policy","Доступ заборонений політикою служби"}. {"Access denied by service policy","Доступ заборонений політикою служби"}.
{"Action on user","Дія над користувачем"}. {"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ụ"}. {"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"}. {"Action on user","Hành động đối với người sử dụng"}.
{"Add Jabber ID","Thêm Jabber ID"}. {"Add Jabber ID","Thêm Jabber ID"}.

View File

@ -1,4 +1,4 @@
%% -*- coding: latin-1 -*- %% -*- coding: utf-8 -*-
{"Accept","Accepter"}. {"Accept","Accepter"}.
{"Access denied by service policy","L' accès a stî rfuzé pal politike do siervice"}. {"Access denied by service policy","L' accès a stî rfuzé pal politike do siervice"}.
{"Action on user","Accion so l' uzeu"}. {"Action on user","Accion so l' uzeu"}.

View File

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

View File

@ -145,12 +145,12 @@ load(Files, Dir) ->
{error, file:filename(), error_reason()}]. {error, file:filename(), error_reason()}].
load_file(File) -> load_file(File) ->
Lang = lang_of_file(File), Lang = lang_of_file(File),
case file:consult(File) of try file:consult(File) of
{ok, Lines} -> {ok, Lines} ->
lists:map( lists:map(
fun({In, Out}) -> fun({In, Out}) ->
try {unicode:characters_to_binary(In, utf8), try {unicode:characters_to_binary(In),
unicode:characters_to_binary(Out, utf8)} of unicode:characters_to_binary(Out)} of
{InB, OutB} when is_binary(InB), is_binary(OutB) -> {InB, OutB} when is_binary(InB), is_binary(OutB) ->
{{Lang, InB}, OutB}; {{Lang, InB}, OutB};
_ -> _ ->
@ -163,6 +163,11 @@ load_file(File) ->
end, Lines); end, Lines);
{error, Reason} -> {error, Reason} ->
[{error, File, 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. end.
-spec translate(binary(), binary()) -> binary(). -spec translate(binary(), binary()) -> binary().
@ -299,7 +304,7 @@ lang_of_file(FileName) ->
format_error(bad_file) -> format_error(bad_file) ->
"corrupted or invalid translation file"; "corrupted or invalid translation file";
format_error(bad_encoding) -> format_error(bad_encoding) ->
"not an UTF-8 encoding"; "cannot translate from UTF-8";
format_error({_, _, _} = Reason) -> format_error({_, _, _} = Reason) ->
"at line " ++ file:format_error(Reason); "at line " ++ file:format_error(Reason);
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 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 "^msgid" $PO_PATH.ms | sed 's/^msgid //g' >$MSGID_PATH
grep "^msgstr" $PO_PATH.ms | sed 's/^msgstr //g' >$MSGSTR_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 paste $MSGID_PATH $MSGSTR_PATH --delimiter=, | awk '{print "{" $0 "}."}' | sort -g >>$MSGS_PATH
rm $MS_PATH rm $MS_PATH