translatomatic 0.1.1 → 0.1.2
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/.gitattributes +19 -0
- data/.gitignore +0 -0
- data/.travis.yml +7 -7
- data/.yardopts +9 -0
- data/Gemfile +4 -4
- data/Guardfile +0 -0
- data/README.de.md +61 -16
- data/README.es.md +60 -15
- data/README.fr.md +61 -16
- data/README.it.md +60 -15
- data/README.ja.md +59 -14
- data/README.ko.md +137 -0
- data/README.md +58 -13
- data/README.ms.md +137 -0
- data/README.pt.md +137 -0
- data/README.ru.md +137 -0
- data/README.sv.md +137 -0
- data/README.zh.md +137 -0
- data/bin/setup +8 -8
- data/bin/translatomatic +6 -6
- data/bin/travis +1 -1
- data/config/locales/translatomatic/de.yml +104 -0
- data/config/locales/translatomatic/en.yml +101 -0
- data/config/locales/translatomatic/es.yml +105 -0
- data/config/locales/translatomatic/fr.yml +105 -0
- data/config/locales/translatomatic/it.yml +103 -0
- data/config/locales/translatomatic/ja.yml +102 -0
- data/config/locales/translatomatic/ko.yml +101 -0
- data/config/locales/translatomatic/ms.yml +103 -0
- data/config/locales/translatomatic/pt.yml +105 -0
- data/config/locales/translatomatic/ru.yml +103 -0
- data/config/locales/translatomatic/sv.yml +103 -0
- data/config/locales/translatomatic/zh.yml +102 -0
- data/db/migrate/201712170000_initial.rb +2 -1
- data/lib/translatomatic/cli/base.rb +73 -0
- data/lib/translatomatic/cli/common_options.rb +14 -0
- data/lib/translatomatic/cli/config.rb +81 -0
- data/lib/translatomatic/cli/database.rb +29 -0
- data/lib/translatomatic/cli/main.rb +112 -0
- data/lib/translatomatic/cli/translate.rb +146 -0
- data/lib/translatomatic/cli.rb +8 -216
- data/lib/translatomatic/config.rb +143 -0
- data/lib/translatomatic/converter.rb +196 -149
- data/lib/translatomatic/converter_stats.rb +18 -14
- data/lib/translatomatic/database.rb +35 -37
- data/lib/translatomatic/escaped_unicode.rb +1 -1
- data/lib/translatomatic/extractor/base.rb +2 -0
- data/lib/translatomatic/extractor/ruby.rb +1 -0
- data/lib/translatomatic/extractor.rb +1 -0
- data/lib/translatomatic/http_request.rb +43 -14
- data/lib/translatomatic/locale.rb +28 -4
- data/lib/translatomatic/logger.rb +21 -13
- data/lib/translatomatic/model/locale.rb +5 -1
- data/lib/translatomatic/model/text.rb +2 -0
- data/lib/translatomatic/model.rb +1 -0
- data/lib/translatomatic/option.rb +75 -10
- data/lib/translatomatic/progress_updater.rb +7 -3
- data/lib/translatomatic/resource_file/base.rb +41 -18
- data/lib/translatomatic/resource_file/html.rb +11 -14
- data/lib/translatomatic/resource_file/markdown.rb +13 -12
- data/lib/translatomatic/resource_file/plist.rb +3 -14
- data/lib/translatomatic/resource_file/properties.rb +21 -3
- data/lib/translatomatic/resource_file/resw.rb +1 -0
- data/lib/translatomatic/resource_file/text.rb +1 -0
- data/lib/translatomatic/resource_file/xcode_strings.rb +23 -14
- data/lib/translatomatic/resource_file/xml.rb +34 -22
- data/lib/translatomatic/resource_file/yaml.rb +39 -5
- data/lib/translatomatic/resource_file.rb +7 -5
- data/lib/translatomatic/string.rb +40 -12
- data/lib/translatomatic/tmx/document.rb +11 -12
- data/lib/translatomatic/tmx/translation_unit.rb +5 -1
- data/lib/translatomatic/tmx.rb +2 -0
- data/lib/translatomatic/translation.rb +30 -0
- data/lib/translatomatic/translation_result.rb +45 -45
- data/lib/translatomatic/translator/base.rb +128 -83
- data/lib/translatomatic/translator/frengly.rb +62 -57
- data/lib/translatomatic/translator/google.rb +35 -31
- data/lib/translatomatic/translator/microsoft.rb +41 -33
- data/lib/translatomatic/translator/my_memory.rb +68 -64
- data/lib/translatomatic/translator/yandex.rb +56 -39
- data/lib/translatomatic/translator.rb +99 -63
- data/lib/translatomatic/util.rb +31 -1
- data/lib/translatomatic/version.rb +4 -1
- data/lib/translatomatic.rb +17 -0
- data/translatomatic.gemspec +5 -4
- metadata +56 -16
@@ -0,0 +1,105 @@
|
|
1
|
+
# Criado por Translatomatic 0.1.1 Mon, 01 Jan 2018 21:36:43 +1030
|
2
|
+
|
3
|
+
pt:
|
4
|
+
translatomatic:
|
5
|
+
cli:
|
6
|
+
config:
|
7
|
+
subcommand: Comandos de configuração
|
8
|
+
configuration: Configuração
|
9
|
+
set: Alterar uma definição de configuração
|
10
|
+
remove: Remover uma definição de configuração
|
11
|
+
list: Lista as definições de configuração atuais
|
12
|
+
describe: Descrever as configurações disponíveis
|
13
|
+
name: Nome
|
14
|
+
type: Tipo
|
15
|
+
value: Valor
|
16
|
+
desc: Descrição
|
17
|
+
translate:
|
18
|
+
subcommand: Traduzir arquivos ou cadeias de caracteres
|
19
|
+
file: Traduzir um arquivo para locais de destino
|
20
|
+
string: Definição da palavra uma sequência de caracteres para localidades
|
21
|
+
de destino
|
22
|
+
source_locale: A localidade do arquivo de origem
|
23
|
+
target_locales: Localidades de tradução para o
|
24
|
+
debug: Habilitar a depuração de saída
|
25
|
+
wank: Ativar a barra de progresso de tradução
|
26
|
+
share: Compartilhar traduções com tradutores que oferecem suporte a carregamento
|
27
|
+
dry_run: 'Dry run: arquivos não irão ser traduzidos ou escritos'
|
28
|
+
locales_required: Uma ou mais localidades necessárias
|
29
|
+
file_not_found: 'Arquivo não encontrado: %{file}'
|
30
|
+
file_unsupported: 'Sem suporte de tipo de arquivo: %{file}'
|
31
|
+
using_translator: 'Usando o Tradutor: %{name}'
|
32
|
+
locales_properties: 'Localidades: %{locales}, propriedades: %{properties}'
|
33
|
+
display_values: Valores de exibição de um pacote de recursos
|
34
|
+
locales_to_display: Locales para exibir
|
35
|
+
display_sentences: Exibir as frases
|
36
|
+
extract_strings: Extrair as strings de arquivos não-recurso
|
37
|
+
list_backends: Lista de serviços de tradução disponíveis
|
38
|
+
display_version: Versão de visualização
|
39
|
+
uploading_tmx: Upload TMX %{name}
|
40
|
+
translating: Tradução em andamento
|
41
|
+
aborted: Abortada
|
42
|
+
file_source: 'Arquivo: %{file}'
|
43
|
+
sentences: 'Frases:'
|
44
|
+
database:
|
45
|
+
subcommand: Comandos de banco de dados
|
46
|
+
search: Pesquisar banco de dados para correspondência determinada sequência
|
47
|
+
de caracteres de texto.
|
48
|
+
resource:
|
49
|
+
unknown_locale: Não é possível determinar a localidade
|
50
|
+
created_by: Criado por %{app} %{version} %{date}
|
51
|
+
error: 'Erro: %{message}'
|
52
|
+
loading: Tentar carregar %{file} usando %{name}
|
53
|
+
tmx:
|
54
|
+
multiple_origins: Múltiplas origens nos textos.
|
55
|
+
multiple_locales: Várias localidades de origem nos textos.
|
56
|
+
translator:
|
57
|
+
email_required: Endereço de email.
|
58
|
+
password_required: Senha necessária.
|
59
|
+
google_key_required: Chave da API do Google exigido.
|
60
|
+
google_api_key: Chave da API do Google
|
61
|
+
frengly_api_key: Chave da API Frengly
|
62
|
+
microsoft_api_key: Chave da API do Microsoft
|
63
|
+
microsoft_key_required: Chave da API do Microsoft necessário.
|
64
|
+
mymemory_api_key: Chave da API do MyMemory
|
65
|
+
email_address: Endereço de e-mail
|
66
|
+
share_response: 'Compartilhar a resposta: %{response}'
|
67
|
+
yandex_api_key: Chave da API Yandex
|
68
|
+
yandex_key_required: Chave da API Yandex exigido.
|
69
|
+
required_option: "(obrigatório)"
|
70
|
+
translators: 'Todos os tradutores:'
|
71
|
+
configured: 'Tradutores configurados:'
|
72
|
+
unavailable: Tradutor %{name} não está disponível.
|
73
|
+
no_translators: Não há tradutores são configurados.
|
74
|
+
password: Senha
|
75
|
+
converter:
|
76
|
+
total_translations: 'Total de traduções: %{total} (%{from_db} de banco de dados,
|
77
|
+
%{from_translator} de tradutor, %{untranslated} não traduzida)'
|
78
|
+
untranslated: 'Untranslated sequências de caracteres:'
|
79
|
+
translator: Implementações de tradutor para usar
|
80
|
+
dry_run: Imprima ações sem realizar traduções ou gravação de arquivos.
|
81
|
+
use_database: Armazenar e recuperar as traduções do banco.
|
82
|
+
database_disabled: Banco de dados é desabilitado.
|
83
|
+
translator_required: Tradutor exigido.
|
84
|
+
file_unsupported: 'Sem suporte de tipo de arquivo: %{file}'
|
85
|
+
translating: Traduzindo %{source} %{target}
|
86
|
+
stats: 'Traduções de banco de dados: %{from_db}, Tradutor: %{from_translator},
|
87
|
+
sem tradução: %{untranslated}'
|
88
|
+
database:
|
89
|
+
no_environment: Nenhum ambiente '%{env}' em %{file}
|
90
|
+
migrated: Banco de dados migrados.
|
91
|
+
created: Banco de dados criado.
|
92
|
+
deleted: Banco de dados excluído.
|
93
|
+
could_not_create: Banco de dados não pôde ser criado.
|
94
|
+
config_file: Caminho para o arquivo de configuração de banco de dados
|
95
|
+
env: Ambiente de banco de dados
|
96
|
+
unicode:
|
97
|
+
invalid_byte: 'Byte de UTF8 inválido: ''%{byte}'''
|
98
|
+
config:
|
99
|
+
invalid_key: 'Chave de configuração não reconhecida: ''%{key}'''
|
100
|
+
types:
|
101
|
+
string: Sequência de caracteres
|
102
|
+
hash: Hash
|
103
|
+
array: Matriz
|
104
|
+
numeric: Numérico
|
105
|
+
boolean: Boolean
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# Созданная Translatomatic 0.1.1 Mon, 01 Jan 2018 21:36:44 +1030
|
2
|
+
|
3
|
+
ru:
|
4
|
+
translatomatic:
|
5
|
+
cli:
|
6
|
+
config:
|
7
|
+
subcommand: Команды конфигурации
|
8
|
+
configuration: Конфигурация
|
9
|
+
set: Изменение параметра конфигурации
|
10
|
+
remove: Удаление параметра конфигурации
|
11
|
+
list: Список текущих параметров конфигурации
|
12
|
+
describe: Описать имеющиеся настройки
|
13
|
+
name: Имя
|
14
|
+
type: Тип
|
15
|
+
value: Значение
|
16
|
+
desc: Описание
|
17
|
+
translate:
|
18
|
+
subcommand: Перевод файлов или строк
|
19
|
+
file: Перевести файл в целевой локали
|
20
|
+
string: Перевод строки к целевой локали
|
21
|
+
source_locale: Языковой стандарт исходного файла
|
22
|
+
target_locales: Языки для перевода
|
23
|
+
debug: Включение отладки вывода
|
24
|
+
wank: Включить индикатор выполнения перевода
|
25
|
+
share: Доля переводов с переводчиками, которые поддерживают загрузку
|
26
|
+
dry_run: 'Пробный прогон: файлы не будут переведены или письменные'
|
27
|
+
locales_required: Требуется один или несколько языков
|
28
|
+
file_not_found: 'Файл не найден: %{file}'
|
29
|
+
file_unsupported: 'Неподдерживаемый тип файла: %{file}'
|
30
|
+
using_translator: 'С помощью переводчика: %{name}'
|
31
|
+
locales_properties: 'Языки: %{locales}, свойства: %{properties}'
|
32
|
+
display_values: Отображение значения из набора ресурсов
|
33
|
+
locales_to_display: Языки для отображения
|
34
|
+
display_sentences: Показать предложения
|
35
|
+
extract_strings: Извлечение строк из файлов-ресурсов
|
36
|
+
list_backends: Список доступных переводческих услуг
|
37
|
+
display_version: Отображение версии
|
38
|
+
uploading_tmx: Загрузка TMX %{name}
|
39
|
+
translating: Выполняется перевод
|
40
|
+
aborted: Прервана
|
41
|
+
file_source: 'Файл: %{file}'
|
42
|
+
sentences: 'Предложения:'
|
43
|
+
database:
|
44
|
+
subcommand: Команды базы данных
|
45
|
+
search: База данных поиска для соответствия заданной строки текста.
|
46
|
+
resource:
|
47
|
+
unknown_locale: Не удается определить язык
|
48
|
+
created_by: Созданная %{app} %{version} %{date}
|
49
|
+
error: 'Ошибка: %{message}'
|
50
|
+
loading: Попытка загрузить %{file}, используя %{name}
|
51
|
+
tmx:
|
52
|
+
multiple_origins: Несколько происхождение в текстах.
|
53
|
+
multiple_locales: Несколько исходных языков в текстах.
|
54
|
+
translator:
|
55
|
+
email_required: Требуется адрес электронной почты.
|
56
|
+
password_required: Требуется пароль.
|
57
|
+
google_key_required: Требуется ключ Google API.
|
58
|
+
google_api_key: Ключ Google API
|
59
|
+
frengly_api_key: Frengly API ключ
|
60
|
+
microsoft_api_key: Microsoft API ключ
|
61
|
+
microsoft_key_required: Требуется ключ Microsoft API.
|
62
|
+
mymemory_api_key: MyMemory API ключ
|
63
|
+
email_address: Адрес электронной почты
|
64
|
+
share_response: 'Доля ответов: %{response}'
|
65
|
+
yandex_api_key: Ключ API Яндекс
|
66
|
+
yandex_key_required: Яндекс API ключа требуется.
|
67
|
+
required_option: "(обязательно)"
|
68
|
+
translators: 'Все переводчики:'
|
69
|
+
configured: 'Настроенные переводчики:'
|
70
|
+
unavailable: Переводчик %{name} недоступна.
|
71
|
+
no_translators: Переводчики не настроены.
|
72
|
+
password: Пароль
|
73
|
+
converter:
|
74
|
+
total_translations: 'Всего переводы: %{total} (%{from_db} из базы данных, %{from_translator}
|
75
|
+
с переводчиком, %{untranslated} untranslated)'
|
76
|
+
untranslated: 'Непереведенные строки:'
|
77
|
+
translator: Чтобы использовать переводчик реализации
|
78
|
+
dry_run: Печать действия без выполнения переводов или записи файлов.
|
79
|
+
use_database: Хранить и извлекать переводы из базы данных.
|
80
|
+
database_disabled: База данных отключена.
|
81
|
+
translator_required: Требуется переводчик.
|
82
|
+
file_unsupported: 'Неподдерживаемый тип файла: %{file}'
|
83
|
+
translating: Перевод %{source} %{target}
|
84
|
+
stats: 'Переводы из базы данных: %{from_db}, переводчик: %{from_translator},
|
85
|
+
untranslated: %{untranslated}'
|
86
|
+
database:
|
87
|
+
no_environment: Не окружающей среды «%{env}» %{file}
|
88
|
+
migrated: База данных миграции.
|
89
|
+
created: База данных, созданная.
|
90
|
+
deleted: База данных удалена.
|
91
|
+
could_not_create: База данных не может быть создан.
|
92
|
+
config_file: Путь к файлу конфигурации базы данных
|
93
|
+
env: Базы данных окружающей среды
|
94
|
+
unicode:
|
95
|
+
invalid_byte: 'Недопустимый UTF8 байт: «%{byte}»'
|
96
|
+
config:
|
97
|
+
invalid_key: 'Непризнанных конфигурационный ключ: «%{key}»'
|
98
|
+
types:
|
99
|
+
string: Строка
|
100
|
+
hash: Хэш
|
101
|
+
array: Массив
|
102
|
+
numeric: Цифровой
|
103
|
+
boolean: Логическое значение
|
@@ -0,0 +1,103 @@
|
|
1
|
+
# Skapad av Translatomatic 0.1.1 Mon, 01 Jan 2018 21:36:44 +1030
|
2
|
+
|
3
|
+
sv:
|
4
|
+
translatomatic:
|
5
|
+
cli:
|
6
|
+
config:
|
7
|
+
subcommand: Konfigurationskommandon
|
8
|
+
configuration: Konfiguration
|
9
|
+
set: Ändra en konfigurationsinställning
|
10
|
+
remove: Ta bort en konfigurationsinställning
|
11
|
+
list: Förteckning aktuella konfigurationsinställningar
|
12
|
+
describe: Beskriv tillgängliga konfigurationsinställningarna
|
13
|
+
name: Namn
|
14
|
+
type: Typ
|
15
|
+
value: Värde
|
16
|
+
desc: Beskrivning
|
17
|
+
translate:
|
18
|
+
subcommand: Översätta filer eller strängar
|
19
|
+
file: Översätta en fil till målet locales
|
20
|
+
string: Översätta en sträng till målet locales
|
21
|
+
source_locale: Lokalen på källfilen
|
22
|
+
target_locales: Språk att översätta till
|
23
|
+
debug: Aktivera felsökning utdata
|
24
|
+
wank: Aktivera översättning förloppsindikatorn
|
25
|
+
share: Dela översättningar med översättare som stöder uppladdning
|
26
|
+
dry_run: 'Torr kör: filer kommer inte att översättas eller skrivit'
|
27
|
+
locales_required: En eller flera lokaler krävs
|
28
|
+
file_not_found: 'Filen hittades inte: %{file}'
|
29
|
+
file_unsupported: 'Unsupported filtypen: %{file}'
|
30
|
+
using_translator: 'Med hjälp av översättare: %{name}'
|
31
|
+
locales_properties: 'Språk: %{locales}, egenskaper: %{properties}'
|
32
|
+
display_values: Visa värden från en resurssamling
|
33
|
+
locales_to_display: Locales att Visa
|
34
|
+
display_sentences: Visa meningar
|
35
|
+
extract_strings: Extrahera strängar från icke-resursfiler
|
36
|
+
list_backends: Listan tillgängliga översättningstjänster
|
37
|
+
display_version: Display-version
|
38
|
+
uploading_tmx: Ladda upp TMX %{name}
|
39
|
+
translating: Att översätta
|
40
|
+
aborted: Avbröts
|
41
|
+
file_source: 'Fil: %{file}'
|
42
|
+
sentences: 'Meningar:'
|
43
|
+
database:
|
44
|
+
subcommand: Databas-kommandon
|
45
|
+
search: Sökdatabas för text på en given sträng.
|
46
|
+
resource:
|
47
|
+
unknown_locale: Det går inte att avgöra locale
|
48
|
+
created_by: Skapad av %{app} %{version} %{date}
|
49
|
+
error: 'Fel: %{message}'
|
50
|
+
loading: Försöker läsa in %{file} med %{name}
|
51
|
+
tmx:
|
52
|
+
multiple_origins: Flera ursprung i texter.
|
53
|
+
multiple_locales: Flera källa lokalanpassningar i texter.
|
54
|
+
translator:
|
55
|
+
email_required: E-postadress krävs.
|
56
|
+
password_required: Lösenord krävs.
|
57
|
+
google_key_required: Google API-nyckel krävs.
|
58
|
+
google_api_key: Google API-nyckel
|
59
|
+
frengly_api_key: Frengly API-nyckel
|
60
|
+
microsoft_api_key: Microsoft API nyckel
|
61
|
+
microsoft_key_required: Microsoft API nyckeln som krävs.
|
62
|
+
mymemory_api_key: MyMemory API-nyckel
|
63
|
+
email_address: E-postadress
|
64
|
+
share_response: 'Dela svar: %{response}'
|
65
|
+
yandex_api_key: Yandex API-nyckel
|
66
|
+
yandex_key_required: Yandex API-nyckel krävs.
|
67
|
+
required_option: "(krävs)"
|
68
|
+
translators: 'Alla översättare:'
|
69
|
+
configured: 'Konfigurerade översättare:'
|
70
|
+
unavailable: Översättare %{name} är inte tillgänglig.
|
71
|
+
no_translators: Ingen översättare är konfigurerade.
|
72
|
+
password: Lösenord
|
73
|
+
converter:
|
74
|
+
total_translations: 'Summa översättningar: %{total} (%{from_db} från databas,
|
75
|
+
%{from_translator} från översättare, %{untranslated} translaterade)'
|
76
|
+
untranslated: 'Oöversatta strängar:'
|
77
|
+
translator: Översättare-implementeringar använda
|
78
|
+
dry_run: Skriva ut åtgärder utan utför översättningar eller skriva filer.
|
79
|
+
use_database: Lagra och hämta översättningar från databasen.
|
80
|
+
database_disabled: Databasen är inaktiverad.
|
81
|
+
translator_required: Översättare som krävs.
|
82
|
+
file_unsupported: 'Unsupported filtypen: %{file}'
|
83
|
+
translating: Att översätta %{source} %{target}
|
84
|
+
stats: 'Översättningar från databas: %{from_db}, översättare: %{from_translator},
|
85
|
+
translaterade: %{untranslated}'
|
86
|
+
database:
|
87
|
+
no_environment: Ingen miljö '%{env}' i %{file}
|
88
|
+
migrated: Databasen migrerad.
|
89
|
+
created: Databas som har skapats.
|
90
|
+
deleted: Databas raderas.
|
91
|
+
could_not_create: Databasen kunde inte skapas.
|
92
|
+
config_file: Sökvägen till databasen konfigurationsfilen
|
93
|
+
env: Databasmiljö
|
94
|
+
unicode:
|
95
|
+
invalid_byte: 'Ogiltigt UTF8 byte: ''%{byte}'''
|
96
|
+
config:
|
97
|
+
invalid_key: 'Konfigurationsnyckel för oredovisade: ''%{key}'''
|
98
|
+
types:
|
99
|
+
string: Sträng
|
100
|
+
hash: Hash
|
101
|
+
array: Array
|
102
|
+
numeric: Numeriska
|
103
|
+
boolean: Boolean
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# 由Translatomatic0.1.1Mon, 01 Jan 2018 21:36:45 +1030 创建
|
2
|
+
|
3
|
+
zh:
|
4
|
+
translatomatic:
|
5
|
+
cli:
|
6
|
+
config:
|
7
|
+
subcommand: 配置命令
|
8
|
+
configuration: 配置
|
9
|
+
set: 更改配置设置
|
10
|
+
remove: 删除配置设置
|
11
|
+
list: 列出当前配置设置
|
12
|
+
describe: 描述可用的配置设置
|
13
|
+
name: 名称
|
14
|
+
type: 类型
|
15
|
+
value: 值
|
16
|
+
desc: 描述
|
17
|
+
translate:
|
18
|
+
subcommand: 翻译文件或字符串
|
19
|
+
file: 将文件转换为目标区域设置
|
20
|
+
string: 将字符串转换为目标区域设置
|
21
|
+
source_locale: 源文件的区域设置
|
22
|
+
target_locales: 要转换为的区域设置
|
23
|
+
debug: 启用调试输出
|
24
|
+
wank: 启用翻译进度栏
|
25
|
+
share: 与支持上载的翻译人员共享翻译
|
26
|
+
dry_run: '干运行: 文件不会被翻译或写入'
|
27
|
+
locales_required: 需要一个或多个区域设置
|
28
|
+
file_not_found: 找不到文件:%{file}
|
29
|
+
file_unsupported: 不支持的文件类型:%{file}
|
30
|
+
using_translator: 使用转换器:%{name}
|
31
|
+
locales_properties: 区域设置:%{locales}, 属性:%{properties}
|
32
|
+
display_values: 显示资源包中的值
|
33
|
+
locales_to_display: 要显示的区域设置
|
34
|
+
display_sentences: 显示句子
|
35
|
+
extract_strings: 从资源文件中提取字符串
|
36
|
+
list_backends: 列出可用的翻译服务
|
37
|
+
display_version: 显示版本
|
38
|
+
uploading_tmx: 正在将 TMX 上载到%{name}
|
39
|
+
translating: 正在翻译
|
40
|
+
aborted: 中止
|
41
|
+
file_source: 文件:%{file}
|
42
|
+
sentences: '句子:'
|
43
|
+
database:
|
44
|
+
subcommand: 数据库命令
|
45
|
+
search: 搜索与给定字符串匹配的文本的数据库。
|
46
|
+
resource:
|
47
|
+
unknown_locale: 无法确定区域设置
|
48
|
+
created_by: 由%{app}%{version}%{date} 创建
|
49
|
+
error: 错误:%{message}
|
50
|
+
loading: 尝试使用%{file} 加载%{name}
|
51
|
+
tmx:
|
52
|
+
multiple_origins: 文本中的多个来源。
|
53
|
+
multiple_locales: 文本中的多个源区域设置。
|
54
|
+
translator:
|
55
|
+
email_required: 需要的电子邮件地址。
|
56
|
+
password_required: 需要密码。
|
57
|
+
google_key_required: 需要 Google API 密钥。
|
58
|
+
google_api_key: 谷歌 API 密钥
|
59
|
+
frengly_api_key: Frengly API 密钥
|
60
|
+
microsoft_api_key: 微软 API 密钥
|
61
|
+
microsoft_key_required: 需要使用 Microsoft API 密钥。
|
62
|
+
mymemory_api_key: MyMemory API 密钥
|
63
|
+
email_address: 电子邮件地址
|
64
|
+
share_response: 共享响应:%{response}
|
65
|
+
yandex_api_key: Yandex API 密钥
|
66
|
+
yandex_key_required: 需要 Yandex API 密钥。
|
67
|
+
required_option: 需要)
|
68
|
+
translators: '所有翻译人员:'
|
69
|
+
configured: '已配置的翻译人员:'
|
70
|
+
unavailable: 转换器%{name} 不可用。
|
71
|
+
no_translators: 未配置任何翻译器。
|
72
|
+
password: 密码
|
73
|
+
converter:
|
74
|
+
total_translations: 总翻译:%{total} (%{from_db} 来自数据库,%{from_translator} 来自翻译器,%{untranslated}
|
75
|
+
未翻译)
|
76
|
+
untranslated: '未翻译的字符串:'
|
77
|
+
translator: 要使用的转换器实现
|
78
|
+
dry_run: 在不执行翻译或写入文件的情况下打印操作。
|
79
|
+
use_database: 存储和检索数据库中的翻译。
|
80
|
+
database_disabled: 数据库被禁用。
|
81
|
+
translator_required: 需要翻译。
|
82
|
+
file_unsupported: 不支持的文件类型:%{file}
|
83
|
+
translating: 将%{source} 转换为%{target}
|
84
|
+
stats: 数据库翻译:%{from_db}, 转换器:%{from_translator}, 未翻译:%{untranslated}
|
85
|
+
database:
|
86
|
+
no_environment: '%{env} 中没有环境 "%{file}"'
|
87
|
+
migrated: 数据库已迁移。
|
88
|
+
created: 数据库已创建。
|
89
|
+
deleted: 数据库已删除。
|
90
|
+
could_not_create: 无法创建数据库。
|
91
|
+
config_file: 数据库配置文件的路径
|
92
|
+
env: 数据库环境
|
93
|
+
unicode:
|
94
|
+
invalid_byte: '无效的 UTF8 字节: "%{byte}"'
|
95
|
+
config:
|
96
|
+
invalid_key: '未配置键: "%{key}"'
|
97
|
+
types:
|
98
|
+
string: 字符串
|
99
|
+
hash: 哈希
|
100
|
+
array: 数组
|
101
|
+
numeric: 数值
|
102
|
+
boolean: 布尔
|
@@ -8,7 +8,7 @@ class Initial < ActiveRecord::Migration[4.2] # :nodoc:
|
|
8
8
|
t.timestamps
|
9
9
|
end
|
10
10
|
|
11
|
-
add_index :locales, [:language, :script, :region]
|
11
|
+
add_index :locales, [:language, :script, :region], unique: true
|
12
12
|
|
13
13
|
create_table :texts do |t|
|
14
14
|
t.belongs_to :locale, index: true, null: false
|
@@ -20,5 +20,6 @@ class Initial < ActiveRecord::Migration[4.2] # :nodoc:
|
|
20
20
|
t.string :translator
|
21
21
|
t.timestamps
|
22
22
|
end
|
23
|
+
|
23
24
|
end
|
24
25
|
end
|
@@ -0,0 +1,73 @@
|
|
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
|
+
data = option.to_hash
|
17
|
+
# use internal ',' splitting for array types
|
18
|
+
data[:type] = :string if data[:type] == :array
|
19
|
+
klass.method_option option.name, data
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def parse_list(list, default = [])
|
24
|
+
# use the default list if the list is empty
|
25
|
+
list = default if list.nil? || list.empty?
|
26
|
+
list = [list] unless list.kind_of?(Array)
|
27
|
+
# split list entries on ','
|
28
|
+
list.collect { |i| i.split(/[, ]/) }.flatten.compact
|
29
|
+
end
|
30
|
+
|
31
|
+
# run the give code block, display exceptions.
|
32
|
+
# return true if the code ran without exceptions
|
33
|
+
def run
|
34
|
+
begin
|
35
|
+
yield
|
36
|
+
true
|
37
|
+
rescue Interrupt
|
38
|
+
puts "\n" + t("cli.aborted")
|
39
|
+
false
|
40
|
+
rescue Exception => e
|
41
|
+
finish_log
|
42
|
+
log.error(e.message)
|
43
|
+
log.debug(e.backtrace.join("\n"))
|
44
|
+
raise e if ENV["TEST"] # reraise exceptions in test
|
45
|
+
false
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def finish_log
|
50
|
+
conf.logger.finish if conf.logger.respond_to?(:finish)
|
51
|
+
end
|
52
|
+
|
53
|
+
def conf
|
54
|
+
Translatomatic::Config.instance
|
55
|
+
end
|
56
|
+
|
57
|
+
# get an option value
|
58
|
+
# use options specified on the command line first.
|
59
|
+
# falls back to configuration values.
|
60
|
+
def cli_option(key)
|
61
|
+
if options[key] && !empty_array?(options[key])
|
62
|
+
options[key]
|
63
|
+
else
|
64
|
+
conf.get(key)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def empty_array?(value)
|
69
|
+
value.kind_of?(Array) && value.empty?
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module Translatomatic::CLI
|
2
|
+
# Defines options common to all command line methods
|
3
|
+
class CommonOptions
|
4
|
+
private
|
5
|
+
include Translatomatic::DefineOptions
|
6
|
+
include Translatomatic::Util
|
7
|
+
|
8
|
+
define_options(
|
9
|
+
{ name: :debug, type: :boolean, default: false, desc: t("cli.debug") },
|
10
|
+
{ name: :wank, type: :boolean, default: true, desc: t("cli.wank") },
|
11
|
+
)
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
module Translatomatic::CLI
|
2
|
+
# Configuration functions for the command line interface
|
3
|
+
class Config < Base
|
4
|
+
|
5
|
+
desc "set key value", t("cli.config.set")
|
6
|
+
thor_options(self, Translatomatic::CLI::CommonOptions)
|
7
|
+
# Change a configuration setting
|
8
|
+
# @param key [String] configuration key
|
9
|
+
# @param value [String] new value for the configuration
|
10
|
+
# @return [String] the new value
|
11
|
+
def set(key, value)
|
12
|
+
run { conf.set(key, value) }
|
13
|
+
end
|
14
|
+
|
15
|
+
desc "remove key", t("cli.config.remove")
|
16
|
+
thor_options(self, Translatomatic::CLI::CommonOptions)
|
17
|
+
# Remove a configuration setting
|
18
|
+
# @param key [String] configuration key to remove
|
19
|
+
# @return [void]
|
20
|
+
def remove(key)
|
21
|
+
run { conf.remove(key) }
|
22
|
+
end
|
23
|
+
|
24
|
+
desc "list", t("cli.config.list")
|
25
|
+
thor_options(self, Translatomatic::CLI::CommonOptions)
|
26
|
+
# List current configuration settings
|
27
|
+
def list
|
28
|
+
run do
|
29
|
+
puts t("cli.config.configuration")
|
30
|
+
print_config_table(:key, :value)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "describe", t("cli.config.describe")
|
35
|
+
thor_options(self, Translatomatic::CLI::CommonOptions)
|
36
|
+
# Describe available configuration settings
|
37
|
+
def describe
|
38
|
+
run do
|
39
|
+
puts t("cli.config.configuration")
|
40
|
+
print_config_table(:key, :type, :desc)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
private
|
45
|
+
|
46
|
+
TABLE_HEADING_MAP = {
|
47
|
+
key: t("cli.config.name"),
|
48
|
+
type: t("cli.config.type"),
|
49
|
+
value: t("cli.config.value"),
|
50
|
+
desc: t("cli.config.desc"),
|
51
|
+
}
|
52
|
+
|
53
|
+
def print_config_table(*columns)
|
54
|
+
puts
|
55
|
+
rows = []
|
56
|
+
rows << columns.collect { |i| TABLE_HEADING_MAP[i] }
|
57
|
+
rows << rows[0].collect { |i| i.gsub(/\w/, '=') }
|
58
|
+
Translatomatic::Config.options.each do |option|
|
59
|
+
key = option.name.to_s
|
60
|
+
data = []
|
61
|
+
columns.each do |column|
|
62
|
+
data << case column
|
63
|
+
when :key
|
64
|
+
key
|
65
|
+
when :value
|
66
|
+
value = conf.get(key)
|
67
|
+
value.nil? ? "-" : value
|
68
|
+
when :type
|
69
|
+
t("config.types.#{option.type}")
|
70
|
+
when :desc
|
71
|
+
option.description
|
72
|
+
end
|
73
|
+
end
|
74
|
+
rows << data
|
75
|
+
end
|
76
|
+
rows.sort_by { |i| i[0] }
|
77
|
+
print_table(rows, indent: 2)
|
78
|
+
puts
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module Translatomatic::CLI
|
2
|
+
# Database functions for the command line interface
|
3
|
+
class Database < Base
|
4
|
+
|
5
|
+
desc "search string [locale]", t("cli.database.search")
|
6
|
+
thor_options(self, Translatomatic::CLI::CommonOptions)
|
7
|
+
thor_options(self, Translatomatic::Database)
|
8
|
+
# Search database for the given string
|
9
|
+
# @param string [String] String to search for
|
10
|
+
# @param locale [String] Optional locale, by default search all locales
|
11
|
+
# @return [void]
|
12
|
+
def search(string, locale = nil)
|
13
|
+
Translatomatic::Database.new(options)
|
14
|
+
texts = Translatomatic::Model::Text.where('value LIKE ?', "%#{string}%")
|
15
|
+
if locale
|
16
|
+
db_locale = Translatomatic::Model::Locale.from_tag(locale)
|
17
|
+
texts = texts.where(locale: db_locale)
|
18
|
+
end
|
19
|
+
texts.find_each do |text|
|
20
|
+
puts "(%s) %s" % [text.locale, text.value]
|
21
|
+
text.translations.each do |translation|
|
22
|
+
puts " -> (%s) %s" % [translation.locale, translation.value]
|
23
|
+
end
|
24
|
+
puts
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|