Fix UTF-8 support in translation files

pull/2968/head
Evgeny Khramtsov 3 years ago
parent 052917961a
commit 9ef52f2b0f
  1. 2
      priv/msgs/ca.msg
  2. 2
      priv/msgs/cs.msg
  3. 2
      priv/msgs/de.msg
  4. 2
      priv/msgs/el.msg
  5. 2
      priv/msgs/eo.msg
  6. 2
      priv/msgs/es.msg
  7. 2
      priv/msgs/fr.msg
  8. 2
      priv/msgs/gl.msg
  9. 2
      priv/msgs/he.msg
  10. 2
      priv/msgs/id.msg
  11. 2
      priv/msgs/it.msg
  12. 2
      priv/msgs/ja.msg
  13. 2
      priv/msgs/nl.msg
  14. 2
      priv/msgs/no.msg
  15. 2
      priv/msgs/pl.msg
  16. 2
      priv/msgs/pt-br.msg
  17. 2
      priv/msgs/pt.msg
  18. 2
      priv/msgs/ru.msg
  19. 2
      priv/msgs/sk.msg
  20. 2
      priv/msgs/sv.msg
  21. 2
      priv/msgs/th.msg
  22. 2
      priv/msgs/tr.msg
  23. 2
      priv/msgs/uk.msg
  24. 2
      priv/msgs/vi.msg
  25. 2
      priv/msgs/wa.msg
  26. 2
      priv/msgs/zh.msg
  27. 13
      src/translate.erl
  28. 2
      tools/prepare-tr.sh

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save