translatomatic 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.translatomatic/config.yml +18 -0
- data/.travis.yml +33 -33
- data/Gemfile +6 -4
- data/README.de.md +53 -18
- data/README.es.md +55 -20
- data/README.fr.md +54 -19
- data/README.it.md +58 -23
- data/README.ja.md +54 -19
- data/README.ko.md +58 -23
- data/README.md +167 -141
- data/README.ms.md +51 -16
- data/README.pt.md +58 -23
- data/README.ru.md +53 -18
- data/README.sv.md +53 -18
- data/README.zh.md +53 -18
- data/bin/translatomatic +6 -6
- data/bin/travis +24 -26
- data/config/locales/translatomatic/de.yml +22 -11
- data/config/locales/translatomatic/en.yml +21 -12
- data/config/locales/translatomatic/es.yml +22 -11
- data/config/locales/translatomatic/fr.yml +22 -12
- data/config/locales/translatomatic/it.yml +22 -11
- data/config/locales/translatomatic/ja.yml +22 -11
- data/config/locales/translatomatic/ko.yml +22 -11
- data/config/locales/translatomatic/ms.yml +22 -11
- data/config/locales/translatomatic/pt.yml +22 -11
- data/config/locales/translatomatic/ru.yml +22 -11
- data/config/locales/translatomatic/sv.yml +22 -11
- data/config/locales/translatomatic/zh.yml +22 -11
- data/db/migrate/201712170000_initial.rb +25 -25
- data/lib/translatomatic/cli/base.rb +81 -73
- data/lib/translatomatic/cli/config.rb +110 -81
- data/lib/translatomatic/cli/main.rb +85 -72
- data/lib/translatomatic/cli/translate.rb +141 -106
- data/lib/translatomatic/cli.rb +8 -8
- data/lib/translatomatic/config.rb +302 -155
- data/lib/translatomatic/converter.rb +28 -260
- data/lib/translatomatic/database.rb +134 -134
- data/lib/translatomatic/define_options.rb +22 -0
- data/lib/translatomatic/escaped_unicode.rb +0 -0
- data/lib/translatomatic/extractor/base.rb +16 -16
- data/lib/translatomatic/extractor/ruby.rb +6 -6
- data/lib/translatomatic/extractor.rb +5 -5
- data/lib/translatomatic/file_translator.rb +269 -0
- data/lib/translatomatic/http_request.rb +162 -162
- data/lib/translatomatic/locale.rb +76 -76
- data/lib/translatomatic/logger.rb +23 -23
- data/lib/translatomatic/model/locale.rb +25 -25
- data/lib/translatomatic/model/text.rb +19 -19
- data/lib/translatomatic/model.rb +1 -1
- data/lib/translatomatic/option.rb +37 -41
- data/lib/translatomatic/progress_updater.rb +13 -13
- data/lib/translatomatic/resource_file/base.rb +269 -192
- data/lib/translatomatic/resource_file/csv.rb +37 -0
- data/lib/translatomatic/resource_file/html.rb +54 -47
- data/lib/translatomatic/resource_file/markdown.rb +50 -55
- data/lib/translatomatic/resource_file/plist.rb +153 -19
- data/lib/translatomatic/resource_file/po.rb +107 -0
- data/lib/translatomatic/resource_file/properties.rb +91 -90
- data/lib/translatomatic/resource_file/resw.rb +50 -30
- data/lib/translatomatic/resource_file/subtitle.rb +75 -0
- data/lib/translatomatic/resource_file/text.rb +24 -30
- data/lib/translatomatic/resource_file/xcode_strings.rb +75 -80
- data/lib/translatomatic/resource_file/xml.rb +98 -91
- data/lib/translatomatic/resource_file/yaml.rb +94 -116
- data/lib/translatomatic/resource_file.rb +87 -78
- data/lib/translatomatic/string.rb +188 -188
- data/lib/translatomatic/tmx/document.rb +99 -99
- data/lib/translatomatic/translation_result.rb +63 -63
- data/lib/translatomatic/{converter_stats.rb → translation_stats.rb} +17 -17
- data/lib/translatomatic/translator/base.rb +1 -1
- data/lib/translatomatic/translator/google.rb +2 -0
- data/lib/translatomatic/translator.rb +10 -2
- data/lib/translatomatic/util.rb +45 -45
- data/lib/translatomatic/version.rb +7 -7
- data/lib/translatomatic.rb +52 -49
- data/translatomatic.gemspec +3 -2
- metadata +25 -5
@@ -1,4 +1,4 @@
|
|
1
|
-
# Criado por Translatomatic 0.1.
|
1
|
+
# Criado por Translatomatic 0.1.2 Sat, 06 Jan 2018 22:56:18 +1030
|
2
2
|
|
3
3
|
pt:
|
4
4
|
translatomatic:
|
@@ -6,6 +6,8 @@ pt:
|
|
6
6
|
config:
|
7
7
|
subcommand: Comandos de configuração
|
8
8
|
configuration: Configuração
|
9
|
+
context_configuration: Configuração para o contexto '%{context}'
|
10
|
+
no_config: Nenhuma configuração encontrada
|
9
11
|
set: Alterar uma definição de configuração
|
10
12
|
remove: Remover uma definição de configuração
|
11
13
|
list: Lista as definições de configuração atuais
|
@@ -14,22 +16,23 @@ pt:
|
|
14
16
|
type: Tipo
|
15
17
|
value: Valor
|
16
18
|
desc: Descrição
|
19
|
+
context: Contexto de configuração
|
20
|
+
convert: Converter o arquivo de origem para o formato de arquivo de destino
|
17
21
|
translate:
|
18
22
|
subcommand: Traduzir arquivos ou cadeias de caracteres
|
19
23
|
file: Traduzir um arquivo para locais de destino
|
20
24
|
string: Definição da palavra uma sequência de caracteres para localidades
|
21
25
|
de destino
|
26
|
+
translator: Implementações de tradutor para usar
|
22
27
|
source_locale: A localidade do arquivo de origem
|
23
28
|
target_locales: Localidades de tradução para o
|
29
|
+
source_files: Arquivos para traduzir
|
24
30
|
debug: Habilitar a depuração de saída
|
25
31
|
wank: Ativar a barra de progresso de tradução
|
26
|
-
share:
|
32
|
+
share: Compartilhamento de traduções com tradutores
|
27
33
|
dry_run: 'Dry run: arquivos não irão ser traduzidos ou escritos'
|
28
|
-
locales_required:
|
29
|
-
file_not_found: 'Arquivo não encontrado: %{file}'
|
30
|
-
file_unsupported: 'Sem suporte de tipo de arquivo: %{file}'
|
34
|
+
locales_required: Um ou mais locais de destino necessários
|
31
35
|
using_translator: 'Usando o Tradutor: %{name}'
|
32
|
-
locales_properties: 'Localidades: %{locales}, propriedades: %{properties}'
|
33
36
|
display_values: Valores de exibição de um pacote de recursos
|
34
37
|
locales_to_display: Locales para exibir
|
35
38
|
display_sentences: Exibir as frases
|
@@ -45,11 +48,15 @@ pt:
|
|
45
48
|
subcommand: Comandos de banco de dados
|
46
49
|
search: Pesquisar banco de dados para correspondência determinada sequência
|
47
50
|
de caracteres de texto.
|
48
|
-
|
51
|
+
file:
|
52
|
+
not_found: 'Arquivo não encontrado: %{file}'
|
53
|
+
unsupported: 'Sem suporte de tipo de arquivo: %{file}'
|
49
54
|
unknown_locale: Não é possível determinar a localidade
|
50
55
|
created_by: Criado por %{app} %{version} %{date}
|
51
56
|
error: 'Erro: %{message}'
|
52
57
|
loading: Tentar carregar %{file} usando %{name}
|
58
|
+
directory: 'Arquivo é um diretório: %{file}'
|
59
|
+
invalid: 'Arquivo é inválido: %{file}'
|
53
60
|
tmx:
|
54
61
|
multiple_origins: Múltiplas origens nos textos.
|
55
62
|
multiple_locales: Várias localidades de origem nos textos.
|
@@ -72,17 +79,15 @@ pt:
|
|
72
79
|
unavailable: Tradutor %{name} não está disponível.
|
73
80
|
no_translators: Não há tradutores são configurados.
|
74
81
|
password: Senha
|
75
|
-
|
82
|
+
file_translator:
|
76
83
|
total_translations: 'Total de traduções: %{total} (%{from_db} de banco de dados,
|
77
84
|
%{from_translator} de tradutor, %{untranslated} não traduzida)'
|
78
85
|
untranslated: 'Untranslated sequências de caracteres:'
|
79
|
-
translator: Implementações de tradutor para usar
|
80
86
|
dry_run: Imprima ações sem realizar traduções ou gravação de arquivos.
|
81
87
|
use_database: Armazenar e recuperar as traduções do banco.
|
82
88
|
database_disabled: Banco de dados é desabilitado.
|
83
89
|
translator_required: Tradutor exigido.
|
84
|
-
|
85
|
-
translating: Traduzindo %{source} %{target}
|
90
|
+
translating: Traduzindo %{source} (%{source_locale}) para %{target} (%{target_locale})
|
86
91
|
stats: 'Traduções de banco de dados: %{from_db}, Tradutor: %{from_translator},
|
87
92
|
sem tradução: %{untranslated}'
|
88
93
|
database:
|
@@ -96,10 +101,16 @@ pt:
|
|
96
101
|
unicode:
|
97
102
|
invalid_byte: 'Byte de UTF8 inválido: ''%{byte}'''
|
98
103
|
config:
|
104
|
+
invalid_context: 'Contexto de configuração não reconhecida: ''%{context}'''
|
99
105
|
invalid_key: 'Chave de configuração não reconhecida: ''%{key}'''
|
106
|
+
command_line_only: Configuração '%{key}' não pode ser salvo.
|
100
107
|
types:
|
101
108
|
string: Sequência de caracteres
|
102
109
|
hash: Hash
|
103
110
|
array: Matriz
|
104
111
|
numeric: Numérico
|
105
112
|
boolean: Boolean
|
113
|
+
context:
|
114
|
+
env: Meio ambiente
|
115
|
+
project: Projeto
|
116
|
+
user: Usuário
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Созданная Translatomatic 0.1.
|
1
|
+
# Созданная Translatomatic 0.1.2 Sat, 06 Jan 2018 22:56:18 +1030
|
2
2
|
|
3
3
|
ru:
|
4
4
|
translatomatic:
|
@@ -6,6 +6,8 @@ ru:
|
|
6
6
|
config:
|
7
7
|
subcommand: Команды конфигурации
|
8
8
|
configuration: Конфигурация
|
9
|
+
context_configuration: Конфигурация для контекста «%{context}»
|
10
|
+
no_config: Конфигурация не найдены
|
9
11
|
set: Изменение параметра конфигурации
|
10
12
|
remove: Удаление параметра конфигурации
|
11
13
|
list: Список текущих параметров конфигурации
|
@@ -14,21 +16,22 @@ ru:
|
|
14
16
|
type: Тип
|
15
17
|
value: Значение
|
16
18
|
desc: Описание
|
19
|
+
context: Контекст конфигурации
|
20
|
+
convert: Преобразовать исходный файл в целевой формат файла
|
17
21
|
translate:
|
18
22
|
subcommand: Перевод файлов или строк
|
19
23
|
file: Перевести файл в целевой локали
|
20
24
|
string: Перевод строки к целевой локали
|
25
|
+
translator: Чтобы использовать переводчик реализации
|
21
26
|
source_locale: Языковой стандарт исходного файла
|
22
27
|
target_locales: Языки для перевода
|
28
|
+
source_files: Файлы для перевода
|
23
29
|
debug: Включение отладки вывода
|
24
30
|
wank: Включить индикатор выполнения перевода
|
25
|
-
share: Доля переводов с
|
31
|
+
share: Доля переводов с переводчиками
|
26
32
|
dry_run: 'Пробный прогон: файлы не будут переведены или письменные'
|
27
|
-
locales_required:
|
28
|
-
file_not_found: 'Файл не найден: %{file}'
|
29
|
-
file_unsupported: 'Неподдерживаемый тип файла: %{file}'
|
33
|
+
locales_required: Один или более целевых языков требуется
|
30
34
|
using_translator: 'С помощью переводчика: %{name}'
|
31
|
-
locales_properties: 'Языки: %{locales}, свойства: %{properties}'
|
32
35
|
display_values: Отображение значения из набора ресурсов
|
33
36
|
locales_to_display: Языки для отображения
|
34
37
|
display_sentences: Показать предложения
|
@@ -43,11 +46,15 @@ ru:
|
|
43
46
|
database:
|
44
47
|
subcommand: Команды базы данных
|
45
48
|
search: База данных поиска для соответствия заданной строки текста.
|
46
|
-
|
49
|
+
file:
|
50
|
+
not_found: 'Файл не найден: %{file}'
|
51
|
+
unsupported: 'Неподдерживаемый тип файла: %{file}'
|
47
52
|
unknown_locale: Не удается определить язык
|
48
53
|
created_by: Созданная %{app} %{version} %{date}
|
49
54
|
error: 'Ошибка: %{message}'
|
50
55
|
loading: Попытка загрузить %{file}, используя %{name}
|
56
|
+
directory: 'Файл представляет собой каталог: %{file}'
|
57
|
+
invalid: 'Недопустимый файл: %{file}'
|
51
58
|
tmx:
|
52
59
|
multiple_origins: Несколько происхождение в текстах.
|
53
60
|
multiple_locales: Несколько исходных языков в текстах.
|
@@ -70,17 +77,15 @@ ru:
|
|
70
77
|
unavailable: Переводчик %{name} недоступна.
|
71
78
|
no_translators: Переводчики не настроены.
|
72
79
|
password: Пароль
|
73
|
-
|
80
|
+
file_translator:
|
74
81
|
total_translations: 'Всего переводы: %{total} (%{from_db} из базы данных, %{from_translator}
|
75
82
|
с переводчиком, %{untranslated} untranslated)'
|
76
83
|
untranslated: 'Непереведенные строки:'
|
77
|
-
translator: Чтобы использовать переводчик реализации
|
78
84
|
dry_run: Печать действия без выполнения переводов или записи файлов.
|
79
85
|
use_database: Хранить и извлекать переводы из базы данных.
|
80
86
|
database_disabled: База данных отключена.
|
81
87
|
translator_required: Требуется переводчик.
|
82
|
-
|
83
|
-
translating: Перевод %{source} %{target}
|
88
|
+
translating: Перевод %{source} (%{source_locale}) %{target} (%{target_locale})
|
84
89
|
stats: 'Переводы из базы данных: %{from_db}, переводчик: %{from_translator},
|
85
90
|
untranslated: %{untranslated}'
|
86
91
|
database:
|
@@ -94,10 +99,16 @@ ru:
|
|
94
99
|
unicode:
|
95
100
|
invalid_byte: 'Недопустимый UTF8 байт: «%{byte}»'
|
96
101
|
config:
|
102
|
+
invalid_context: 'Контекст непризнанных конфигурации: «%{context}»'
|
97
103
|
invalid_key: 'Непризнанных конфигурационный ключ: «%{key}»'
|
104
|
+
command_line_only: Не удается сохранить конфигурации «%{key}»
|
98
105
|
types:
|
99
106
|
string: Строка
|
100
107
|
hash: Хэш
|
101
108
|
array: Массив
|
102
109
|
numeric: Цифровой
|
103
110
|
boolean: Логическое значение
|
111
|
+
context:
|
112
|
+
env: Окружающая среда
|
113
|
+
project: Проект
|
114
|
+
user: Пользователь
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Skapad av Translatomatic 0.1.
|
1
|
+
# Skapad av Translatomatic 0.1.2 Sat, 06 Jan 2018 22:56:18 +1030
|
2
2
|
|
3
3
|
sv:
|
4
4
|
translatomatic:
|
@@ -6,6 +6,8 @@ sv:
|
|
6
6
|
config:
|
7
7
|
subcommand: Konfigurationskommandon
|
8
8
|
configuration: Konfiguration
|
9
|
+
context_configuration: Konfiguration för sammanhang '%{context}'
|
10
|
+
no_config: Ingen konfiguration som hittade
|
9
11
|
set: Ändra en konfigurationsinställning
|
10
12
|
remove: Ta bort en konfigurationsinställning
|
11
13
|
list: Förteckning aktuella konfigurationsinställningar
|
@@ -14,21 +16,22 @@ sv:
|
|
14
16
|
type: Typ
|
15
17
|
value: Värde
|
16
18
|
desc: Beskrivning
|
19
|
+
context: Konfiguration sammanhang
|
20
|
+
convert: Konvertera källfilen till mål-format
|
17
21
|
translate:
|
18
22
|
subcommand: Översätta filer eller strängar
|
19
23
|
file: Översätta en fil till målet locales
|
20
24
|
string: Översätta en sträng till målet locales
|
25
|
+
translator: Översättare-implementeringar använda
|
21
26
|
source_locale: Lokalen på källfilen
|
22
27
|
target_locales: Språk att översätta till
|
28
|
+
source_files: Filer att översätta
|
23
29
|
debug: Aktivera felsökning utdata
|
24
30
|
wank: Aktivera översättning förloppsindikatorn
|
25
|
-
share: Dela översättningar med översättare
|
31
|
+
share: Dela översättningar med översättare
|
26
32
|
dry_run: 'Torr kör: filer kommer inte att översättas eller skrivit'
|
27
|
-
locales_required:
|
28
|
-
file_not_found: 'Filen hittades inte: %{file}'
|
29
|
-
file_unsupported: 'Unsupported filtypen: %{file}'
|
33
|
+
locales_required: Ett eller flera mål locales krävs
|
30
34
|
using_translator: 'Med hjälp av översättare: %{name}'
|
31
|
-
locales_properties: 'Språk: %{locales}, egenskaper: %{properties}'
|
32
35
|
display_values: Visa värden från en resurssamling
|
33
36
|
locales_to_display: Locales att Visa
|
34
37
|
display_sentences: Visa meningar
|
@@ -43,11 +46,15 @@ sv:
|
|
43
46
|
database:
|
44
47
|
subcommand: Databas-kommandon
|
45
48
|
search: Sökdatabas för text på en given sträng.
|
46
|
-
|
49
|
+
file:
|
50
|
+
not_found: 'Filen hittades inte: %{file}'
|
51
|
+
unsupported: 'Unsupported filtypen: %{file}'
|
47
52
|
unknown_locale: Det går inte att avgöra locale
|
48
53
|
created_by: Skapad av %{app} %{version} %{date}
|
49
54
|
error: 'Fel: %{message}'
|
50
55
|
loading: Försöker läsa in %{file} med %{name}
|
56
|
+
directory: 'Filen är en katalog: %{file}'
|
57
|
+
invalid: 'Filen är ogiltig: %{file}'
|
51
58
|
tmx:
|
52
59
|
multiple_origins: Flera ursprung i texter.
|
53
60
|
multiple_locales: Flera källa lokalanpassningar i texter.
|
@@ -70,17 +77,15 @@ sv:
|
|
70
77
|
unavailable: Översättare %{name} är inte tillgänglig.
|
71
78
|
no_translators: Ingen översättare är konfigurerade.
|
72
79
|
password: Lösenord
|
73
|
-
|
80
|
+
file_translator:
|
74
81
|
total_translations: 'Summa översättningar: %{total} (%{from_db} från databas,
|
75
82
|
%{from_translator} från översättare, %{untranslated} translaterade)'
|
76
83
|
untranslated: 'Oöversatta strängar:'
|
77
|
-
translator: Översättare-implementeringar använda
|
78
84
|
dry_run: Skriva ut åtgärder utan utför översättningar eller skriva filer.
|
79
85
|
use_database: Lagra och hämta översättningar från databasen.
|
80
86
|
database_disabled: Databasen är inaktiverad.
|
81
87
|
translator_required: Översättare som krävs.
|
82
|
-
|
83
|
-
translating: Att översätta %{source} %{target}
|
88
|
+
translating: Att översätta %{source} (%{source_locale}) till %{target} (%{target_locale})
|
84
89
|
stats: 'Översättningar från databas: %{from_db}, översättare: %{from_translator},
|
85
90
|
translaterade: %{untranslated}'
|
86
91
|
database:
|
@@ -94,10 +99,16 @@ sv:
|
|
94
99
|
unicode:
|
95
100
|
invalid_byte: 'Ogiltigt UTF8 byte: ''%{byte}'''
|
96
101
|
config:
|
102
|
+
invalid_context: 'Oredovisade konfiguration sammanhang: ''%{context}'''
|
97
103
|
invalid_key: 'Konfigurationsnyckel för oredovisade: ''%{key}'''
|
104
|
+
command_line_only: Konfiguration '%{key}' kan inte sparas
|
98
105
|
types:
|
99
106
|
string: Sträng
|
100
107
|
hash: Hash
|
101
108
|
array: Array
|
102
109
|
numeric: Numeriska
|
103
110
|
boolean: Boolean
|
111
|
+
context:
|
112
|
+
env: Miljö
|
113
|
+
project: Projektet
|
114
|
+
user: Användaren
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# 由Translatomatic0.1.
|
1
|
+
# 由Translatomatic0.1.2Sat, 06 Jan 2018 22:56:18 +1030 创建
|
2
2
|
|
3
3
|
zh:
|
4
4
|
translatomatic:
|
@@ -6,6 +6,8 @@ zh:
|
|
6
6
|
config:
|
7
7
|
subcommand: 配置命令
|
8
8
|
configuration: 配置
|
9
|
+
context_configuration: 上下文 "%{context}" 的配置
|
10
|
+
no_config: 找不到配置
|
9
11
|
set: 更改配置设置
|
10
12
|
remove: 删除配置设置
|
11
13
|
list: 列出当前配置设置
|
@@ -14,21 +16,22 @@ zh:
|
|
14
16
|
type: 类型
|
15
17
|
value: 值
|
16
18
|
desc: 描述
|
19
|
+
context: 配置上下文
|
20
|
+
convert: 将源文件转换为目标文件格式
|
17
21
|
translate:
|
18
22
|
subcommand: 翻译文件或字符串
|
19
23
|
file: 将文件转换为目标区域设置
|
20
24
|
string: 将字符串转换为目标区域设置
|
25
|
+
translator: 要使用的转换器实现
|
21
26
|
source_locale: 源文件的区域设置
|
22
27
|
target_locales: 要转换为的区域设置
|
28
|
+
source_files: 要翻译的文件
|
23
29
|
debug: 启用调试输出
|
24
30
|
wank: 启用翻译进度栏
|
25
|
-
share:
|
31
|
+
share: 与翻译人员共享翻译
|
26
32
|
dry_run: '干运行: 文件不会被翻译或写入'
|
27
|
-
locales_required:
|
28
|
-
file_not_found: 找不到文件:%{file}
|
29
|
-
file_unsupported: 不支持的文件类型:%{file}
|
33
|
+
locales_required: 需要一个或多个目标区域设置
|
30
34
|
using_translator: 使用转换器:%{name}
|
31
|
-
locales_properties: 区域设置:%{locales}, 属性:%{properties}
|
32
35
|
display_values: 显示资源包中的值
|
33
36
|
locales_to_display: 要显示的区域设置
|
34
37
|
display_sentences: 显示句子
|
@@ -43,11 +46,15 @@ zh:
|
|
43
46
|
database:
|
44
47
|
subcommand: 数据库命令
|
45
48
|
search: 搜索与给定字符串匹配的文本的数据库。
|
46
|
-
|
49
|
+
file:
|
50
|
+
not_found: 找不到文件:%{file}
|
51
|
+
unsupported: 不支持的文件类型:%{file}
|
47
52
|
unknown_locale: 无法确定区域设置
|
48
53
|
created_by: 由%{app}%{version}%{date} 创建
|
49
54
|
error: 错误:%{message}
|
50
55
|
loading: 尝试使用%{file} 加载%{name}
|
56
|
+
directory: 文件是一个目录:%{file}
|
57
|
+
invalid: 文件无效:%{file}
|
51
58
|
tmx:
|
52
59
|
multiple_origins: 文本中的多个来源。
|
53
60
|
multiple_locales: 文本中的多个源区域设置。
|
@@ -70,17 +77,15 @@ zh:
|
|
70
77
|
unavailable: 转换器%{name} 不可用。
|
71
78
|
no_translators: 未配置任何翻译器。
|
72
79
|
password: 密码
|
73
|
-
|
80
|
+
file_translator:
|
74
81
|
total_translations: 总翻译:%{total} (%{from_db} 来自数据库,%{from_translator} 来自翻译器,%{untranslated}
|
75
82
|
未翻译)
|
76
83
|
untranslated: '未翻译的字符串:'
|
77
|
-
translator: 要使用的转换器实现
|
78
84
|
dry_run: 在不执行翻译或写入文件的情况下打印操作。
|
79
85
|
use_database: 存储和检索数据库中的翻译。
|
80
86
|
database_disabled: 数据库被禁用。
|
81
87
|
translator_required: 需要翻译。
|
82
|
-
|
83
|
-
translating: 将%{source} 转换为%{target}
|
88
|
+
translating: 将%{source} (%{source_locale}) 转换为%{target} (%{target_locale})
|
84
89
|
stats: 数据库翻译:%{from_db}, 转换器:%{from_translator}, 未翻译:%{untranslated}
|
85
90
|
database:
|
86
91
|
no_environment: '%{env} 中没有环境 "%{file}"'
|
@@ -93,10 +98,16 @@ zh:
|
|
93
98
|
unicode:
|
94
99
|
invalid_byte: '无效的 UTF8 字节: "%{byte}"'
|
95
100
|
config:
|
101
|
+
invalid_context: '未配置上下文: "%{context}"'
|
96
102
|
invalid_key: '未配置键: "%{key}"'
|
103
|
+
command_line_only: 无法保存配置 "%{key}"
|
97
104
|
types:
|
98
105
|
string: 字符串
|
99
106
|
hash: 哈希
|
100
107
|
array: 数组
|
101
108
|
numeric: 数值
|
102
109
|
boolean: 布尔
|
110
|
+
context:
|
111
|
+
env: 环境
|
112
|
+
project: 项目
|
113
|
+
user: 用户
|
@@ -1,25 +1,25 @@
|
|
1
|
-
# @!visibility private
|
2
|
-
class Initial < ActiveRecord::Migration[4.2] # :nodoc:
|
3
|
-
def change
|
4
|
-
create_table :locales do |t|
|
5
|
-
t.string :language, null: false # e.g. "en" ISO 639-1
|
6
|
-
t.string :script # e.g. "Hans" ISO 15924
|
7
|
-
t.string :region # e.g. "US" ISO 3166-1 alpha-2
|
8
|
-
t.timestamps
|
9
|
-
end
|
10
|
-
|
11
|
-
add_index :locales, [:language, :script, :region], unique: true
|
12
|
-
|
13
|
-
create_table :texts do |t|
|
14
|
-
t.belongs_to :locale, index: true, null: false
|
15
|
-
t.belongs_to :from_text, index: true, foreign_key: {
|
16
|
-
to_table: :texts, on_delete: :cascade
|
17
|
-
}
|
18
|
-
t.text :value, null: false
|
19
|
-
t.boolean :shared, null: false, default: false, index: true
|
20
|
-
t.string :translator
|
21
|
-
t.timestamps
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
1
|
+
# @!visibility private
|
2
|
+
class Initial < ActiveRecord::Migration[4.2] # :nodoc:
|
3
|
+
def change
|
4
|
+
create_table :locales do |t|
|
5
|
+
t.string :language, null: false # e.g. "en" ISO 639-1
|
6
|
+
t.string :script # e.g. "Hans" ISO 15924
|
7
|
+
t.string :region # e.g. "US" ISO 3166-1 alpha-2
|
8
|
+
t.timestamps
|
9
|
+
end
|
10
|
+
|
11
|
+
add_index :locales, [:language, :script, :region], unique: true
|
12
|
+
|
13
|
+
create_table :texts do |t|
|
14
|
+
t.belongs_to :locale, index: true, null: false
|
15
|
+
t.belongs_to :from_text, index: true, foreign_key: {
|
16
|
+
to_table: :texts, on_delete: :cascade
|
17
|
+
}
|
18
|
+
t.text :value, null: false
|
19
|
+
t.boolean :shared, null: false, default: false, index: true
|
20
|
+
t.string :translator
|
21
|
+
t.timestamps
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -1,73 +1,81 @@
|
|
1
|
-
require 'thor'
|
2
|
-
|
3
|
-
module Translatomatic::CLI
|
4
|
-
# Base class for command line interface classes
|
5
|
-
class Base < Thor
|
6
|
-
|
7
|
-
private
|
8
|
-
|
9
|
-
include Translatomatic::Util
|
10
|
-
include Translatomatic::DefineOptions
|
11
|
-
|
12
|
-
# creates thor options
|
13
|
-
def self.thor_options(klass, object)
|
14
|
-
Translatomatic::Option.options_from_object(object).each do |option|
|
15
|
-
next if option.hidden
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
list
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
#
|
60
|
-
def cli_option(key)
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
end
|
1
|
+
require 'thor'
|
2
|
+
|
3
|
+
module Translatomatic::CLI
|
4
|
+
# Base class for command line interface classes
|
5
|
+
class Base < Thor
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
include Translatomatic::Util
|
10
|
+
include Translatomatic::DefineOptions
|
11
|
+
|
12
|
+
# creates thor options
|
13
|
+
def self.thor_options(klass, object)
|
14
|
+
Translatomatic::Option.options_from_object(object).each do |option|
|
15
|
+
next if option.hidden
|
16
|
+
klass.method_option option.name, option.to_thor
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def parse_list(list, default = [])
|
21
|
+
# use the default list if the list is empty
|
22
|
+
list = default if list.nil? || list.empty?
|
23
|
+
list = [list] unless list.kind_of?(Array)
|
24
|
+
# split list entries on ','
|
25
|
+
list.compact.collect { |i| i.split(/[, ]/) }.flatten.compact
|
26
|
+
end
|
27
|
+
|
28
|
+
# run the give code block, display exceptions.
|
29
|
+
# return true if the code ran without exceptions
|
30
|
+
def run
|
31
|
+
begin
|
32
|
+
merge_options_and_config
|
33
|
+
@dry_run = cli_option(:dry_run)
|
34
|
+
conf.logger.level = Logger::DEBUG if cli_option(:debug)
|
35
|
+
log.info(t("cli.dry_run")) if @dry_run
|
36
|
+
|
37
|
+
yield
|
38
|
+
true
|
39
|
+
rescue Interrupt
|
40
|
+
puts "\n" + t("cli.aborted")
|
41
|
+
false
|
42
|
+
rescue Exception => e
|
43
|
+
finish_log
|
44
|
+
log.error(e.message)
|
45
|
+
log.debug(e.backtrace.join("\n"))
|
46
|
+
raise e if ENV["TEST"] # reraise exceptions in test
|
47
|
+
false
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
def finish_log
|
52
|
+
conf.logger.finish if conf.logger.respond_to?(:finish)
|
53
|
+
end
|
54
|
+
|
55
|
+
def conf
|
56
|
+
Translatomatic.config
|
57
|
+
end
|
58
|
+
|
59
|
+
# get an option value
|
60
|
+
def cli_option(key)
|
61
|
+
@options[key]
|
62
|
+
end
|
63
|
+
|
64
|
+
# create @options from options and config
|
65
|
+
def merge_options_and_config
|
66
|
+
# start with command line options
|
67
|
+
@options = options.transform_keys { |i| i.to_sym }
|
68
|
+
# fill missing entries with config values
|
69
|
+
Translatomatic::Config.options.each do |option|
|
70
|
+
unless @options.include?(option.name)
|
71
|
+
@options[option.name] = conf.get(option.name)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def empty_array?(value)
|
77
|
+
value.kind_of?(Array) && value.empty?
|
78
|
+
end
|
79
|
+
|
80
|
+
end
|
81
|
+
end
|