translatomatic 0.1.3 → 0.2.0
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 +5 -5
- data/.gitattributes +20 -20
- data/.gitignore +19 -15
- data/.rspec +3 -3
- data/.rubocop.yml +28 -0
- data/.translatomatic/config.yml +4 -0
- data/.travis.yml +4 -6
- data/.yardopts +9 -9
- data/Gemfile +8 -4
- data/Guardfile +4 -5
- data/README.de.md +55 -50
- data/README.en.md +177 -0
- data/README.es.md +53 -48
- data/README.fr.md +53 -48
- data/README.it.md +54 -49
- data/README.ja.md +63 -58
- data/README.ko.md +59 -54
- data/README.md +17 -13
- data/README.ms.md +50 -45
- data/README.pt.md +54 -49
- data/README.ru.md +57 -52
- data/README.sv.md +51 -46
- data/README.zh.md +60 -55
- data/Rakefile +3 -3
- data/TODO.txt +6 -0
- data/bin/console +3 -3
- data/bin/translatomatic +4 -2
- data/config/i18n-tasks.yml +130 -0
- data/config/locales/translatomatic/de.yml +141 -99
- data/config/locales/translatomatic/en.yml +129 -89
- data/config/locales/translatomatic/es.yml +136 -99
- data/config/locales/translatomatic/fr.yml +139 -100
- data/config/locales/translatomatic/it.yml +135 -97
- data/config/locales/translatomatic/ja.yml +137 -98
- data/config/locales/translatomatic/ko.yml +138 -98
- data/config/locales/translatomatic/ms.yml +138 -100
- data/config/locales/translatomatic/pt.yml +137 -101
- data/config/locales/translatomatic/ru.yml +136 -98
- data/config/locales/translatomatic/sv.yml +134 -96
- data/config/locales/translatomatic/zh.yml +136 -97
- data/db/migrate/201712170000_initial.rb +2 -3
- data/lib/translatomatic.rb +40 -25
- data/lib/translatomatic/cli.rb +5 -1
- data/lib/translatomatic/cli/base.rb +61 -58
- data/lib/translatomatic/cli/common_options.rb +14 -11
- data/lib/translatomatic/cli/config.rb +96 -91
- data/lib/translatomatic/cli/database.rb +85 -23
- data/lib/translatomatic/cli/main.rb +158 -104
- data/lib/translatomatic/cli/thor.rb +29 -0
- data/lib/translatomatic/cli/translate.rb +134 -157
- data/lib/translatomatic/config.rb +10 -301
- data/lib/translatomatic/config/display.rb +78 -0
- data/lib/translatomatic/config/files.rb +60 -0
- data/lib/translatomatic/config/location_settings.rb +133 -0
- data/lib/translatomatic/config/options.rb +68 -0
- data/lib/translatomatic/config/selector.rb +127 -0
- data/lib/translatomatic/config/settings.rb +148 -0
- data/lib/translatomatic/converter.rb +40 -28
- data/lib/translatomatic/database.rb +127 -110
- data/lib/translatomatic/define_options.rb +4 -5
- data/lib/translatomatic/escaped_unicode.rb +86 -76
- data/lib/translatomatic/extractor.rb +5 -2
- data/lib/translatomatic/extractor/base.rb +12 -12
- data/lib/translatomatic/extractor/ruby.rb +7 -6
- data/lib/translatomatic/file_translator.rb +101 -244
- data/lib/translatomatic/flattenation.rb +39 -0
- data/lib/translatomatic/http.rb +13 -0
- data/lib/translatomatic/http/client.rb +144 -0
- data/lib/translatomatic/http/exception.rb +43 -0
- data/lib/translatomatic/http/file_param.rb +27 -0
- data/lib/translatomatic/http/param.rb +37 -0
- data/lib/translatomatic/http/request.rb +91 -0
- data/lib/translatomatic/i18n.rb +43 -0
- data/lib/translatomatic/locale.rb +71 -59
- data/lib/translatomatic/logger.rb +43 -28
- data/lib/translatomatic/metadata.rb +58 -0
- data/lib/translatomatic/model.rb +4 -2
- data/lib/translatomatic/model/locale.rb +5 -5
- data/lib/translatomatic/model/text.rb +5 -5
- data/lib/translatomatic/option.rb +57 -34
- data/lib/translatomatic/path_utils.rb +126 -0
- data/lib/translatomatic/progress_updater.rb +13 -16
- data/lib/translatomatic/provider.rb +101 -0
- data/lib/translatomatic/provider/base.rb +136 -0
- data/lib/translatomatic/provider/frengly.rb +55 -0
- data/lib/translatomatic/provider/google.rb +78 -0
- data/lib/translatomatic/provider/google_web.rb +50 -0
- data/lib/translatomatic/provider/microsoft.rb +144 -0
- data/lib/translatomatic/provider/my_memory.rb +75 -0
- data/lib/translatomatic/provider/yandex.rb +61 -0
- data/lib/translatomatic/resource_file.rb +59 -53
- data/lib/translatomatic/resource_file/base.rb +171 -237
- data/lib/translatomatic/resource_file/csv.rb +176 -24
- data/lib/translatomatic/resource_file/html.rb +21 -42
- data/lib/translatomatic/resource_file/key_value_support.rb +117 -0
- data/lib/translatomatic/resource_file/markdown.rb +36 -38
- data/lib/translatomatic/resource_file/plist.rb +121 -126
- data/lib/translatomatic/resource_file/po.rb +104 -82
- data/lib/translatomatic/resource_file/properties.rb +48 -77
- data/lib/translatomatic/resource_file/properties.treetop +87 -0
- data/lib/translatomatic/resource_file/resw.rb +56 -41
- data/lib/translatomatic/resource_file/subtitle.rb +86 -54
- data/lib/translatomatic/resource_file/text.rb +18 -18
- data/lib/translatomatic/resource_file/xcode_strings.rb +32 -63
- data/lib/translatomatic/resource_file/xcode_strings.treetop +85 -0
- data/lib/translatomatic/resource_file/xml.rb +94 -81
- data/lib/translatomatic/resource_file/yaml.rb +54 -68
- data/lib/translatomatic/retry_executor.rb +37 -0
- data/lib/translatomatic/slurp.rb +32 -0
- data/lib/translatomatic/string_batcher.rb +50 -0
- data/lib/translatomatic/string_escaping.rb +61 -0
- data/lib/translatomatic/text.rb +263 -0
- data/lib/translatomatic/text_collection.rb +66 -0
- data/lib/translatomatic/tmx.rb +5 -3
- data/lib/translatomatic/tmx/document.rb +107 -82
- data/lib/translatomatic/tmx/translation_unit.rb +19 -18
- data/lib/translatomatic/translation.rb +8 -28
- data/lib/translatomatic/translation/collection.rb +199 -0
- data/lib/translatomatic/translation/fetcher.rb +123 -0
- data/lib/translatomatic/translation/munging.rb +112 -0
- data/lib/translatomatic/translation/result.rb +50 -0
- data/lib/translatomatic/translation/sharer.rb +32 -0
- data/lib/translatomatic/translation/stats.rb +44 -0
- data/lib/translatomatic/translator.rb +91 -88
- data/lib/translatomatic/type_cast.rb +63 -0
- data/lib/translatomatic/util.rb +37 -33
- data/lib/translatomatic/version.rb +2 -2
- data/translatomatic.gemspec +57 -46
- metadata +136 -59
- data/lib/translatomatic/http_request.rb +0 -162
- data/lib/translatomatic/string.rb +0 -188
- data/lib/translatomatic/translation_result.rb +0 -86
- data/lib/translatomatic/translation_stats.rb +0 -31
- data/lib/translatomatic/translator/base.rb +0 -128
- data/lib/translatomatic/translator/frengly.rb +0 -62
- data/lib/translatomatic/translator/google.rb +0 -37
- data/lib/translatomatic/translator/microsoft.rb +0 -41
- data/lib/translatomatic/translator/my_memory.rb +0 -68
- data/lib/translatomatic/translator/yandex.rb +0 -56
data/README.en.md
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
[](http://www.rubydoc.info/gems/translatomatic)[](https://badge.fury.io/rb/translatomatic)[](https://travis-ci.org/smugglys/translatomatic)[](https://codeclimate.com/github/smugglys/translatomatic)
|
2
|
+
|
3
|
+
# Translatomatic
|
4
|
+
|
5
|
+
Translates text files from one language to another, or from one format to another. The following file formats are currently supported:
|
6
|
+
|
7
|
+
| File format | Extensions |
|
8
|
+
| --- | --- |
|
9
|
+
| [Properties](https://en.wikipedia.org/wiki/.properties) | `.properties` |
|
10
|
+
| Windows resource files | `.resw, .resx` |
|
11
|
+
| [Property lists](https://en.wikipedia.org/wiki/Property_list) (OSX plist) | `.plist` |
|
12
|
+
| [PO files](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) | `.po, .pot` |
|
13
|
+
| [XCode strings](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html) | `.strings` |
|
14
|
+
| [YAML](http://yaml.org/) | `.yaml` |
|
15
|
+
| Subtitles | `.srt, .ass, .ssa` |
|
16
|
+
| HTML | `.html, .htm, .shtml` |
|
17
|
+
| XML | `.xml` |
|
18
|
+
| [Markdown](https://en.wikipedia.org/wiki/Markdown) | `.md` |
|
19
|
+
| Text files | `.txt` |
|
20
|
+
| CSV files | `.csv` |
|
21
|
+
|
22
|
+
The following translation providers can be used with Translatomatic:
|
23
|
+
|
24
|
+
- [Google](https://cloud.google.com/translate/)
|
25
|
+
- [Microsoft](https://www.microsoft.com/en-us/translator/translatorapi.aspx)
|
26
|
+
- [Yandex](https://tech.yandex.com/translate/)
|
27
|
+
- [MyMemory](https://mymemory.translated.net/doc/)
|
28
|
+
- [Frengly](http://www.frengly.com/api)
|
29
|
+
|
30
|
+
Translated strings are saved in a database and reused.
|
31
|
+
|
32
|
+
* * *
|
33
|
+
|
34
|
+
## Installation
|
35
|
+
|
36
|
+
Add this line to your application’s `Gemfile`:
|
37
|
+
|
38
|
+
`ruby
|
39
|
+
gem 'translatomatic'
|
40
|
+
`
|
41
|
+
|
42
|
+
And then execute:
|
43
|
+
|
44
|
+
$ bundle
|
45
|
+
|
46
|
+
Or install it yourself as:
|
47
|
+
|
48
|
+
$ gem install translatomatic
|
49
|
+
|
50
|
+
* * *
|
51
|
+
|
52
|
+
## Usage
|
53
|
+
|
54
|
+
This gem provides an executable called `translatomatic`. The `translatomatic` command has a number of functions, not all of which are documented here. For help on available commands and options, execute:
|
55
|
+
|
56
|
+
$ translatomatic help
|
57
|
+
|
58
|
+
And for help on a command, execute:
|
59
|
+
|
60
|
+
$ translatomatic translate help
|
61
|
+
$ translatomatic translate help file
|
62
|
+
|
63
|
+
* * *
|
64
|
+
|
65
|
+
## Setup
|
66
|
+
|
67
|
+
Check for available translation providers and options with the `providers` command:
|
68
|
+
|
69
|
+
$ translatomatic providers
|
70
|
+
|
71
|
+
Options can be specified on the command line, in environment variables, or in translatomatic’s configuration files. The configuration files can be modified using translatomatic’s internal `config` command. To list all available configuration settings, use:
|
72
|
+
|
73
|
+
$ translatomatic config list
|
74
|
+
$ translatomatic config describe
|
75
|
+
|
76
|
+
Options can be set at the user level or the project level. See also the Configuration section below for more information.
|
77
|
+
|
78
|
+
* * *
|
79
|
+
|
80
|
+
## Translating files
|
81
|
+
|
82
|
+
When translating files, `translatomatic` translates text one sentence or phrase at a time. If a file is re-translated, only sentences that have changed since the last translation are sent to the translation provider, and the rest are sourced from the local database.
|
83
|
+
|
84
|
+
To translate a Java properties file to German and French using the Google provider:
|
85
|
+
|
86
|
+
$ translatomatic translate file --provider Google strings.properties de,fr
|
87
|
+
|
88
|
+
This would create (or overwrite) `strings_de.properties` and `strings_fr.properties` with translated properties.
|
89
|
+
|
90
|
+
### Displaying strings from a resource bundle
|
91
|
+
|
92
|
+
To read and display the `store.description` and `store.name` properties from local resource files in English, German, and French:
|
93
|
+
|
94
|
+
$ translatomatic display --locales=en,de,fr \
|
95
|
+
resources/strings.properties store.description store.name
|
96
|
+
|
97
|
+
### Extracting strings from source files
|
98
|
+
|
99
|
+
To extract strings from source files, use the `strings` command, e.g.
|
100
|
+
|
101
|
+
$ translatomatic strings file.rb
|
102
|
+
|
103
|
+
* * *
|
104
|
+
|
105
|
+
## Converting files
|
106
|
+
|
107
|
+
Translatomatic can be used to convert files from one format to another. For example, to convert a Java properties file to an XCode strings file:
|
108
|
+
|
109
|
+
$ translatomatic convert strings.properties Localization.strings
|
110
|
+
|
111
|
+
* * *
|
112
|
+
|
113
|
+
## Configuration
|
114
|
+
|
115
|
+
Configuration settings can be read and written using the `config get` and `config set` commands. Translatomatic uses a user configuration file at `$HOME/.translatomatic/config.yml`, and optionally a per project configuration file `$PROJECT_DIR/.translatomatic/config.yml`.
|
116
|
+
|
117
|
+
The `--user` and `--project` options can be used to tell the command to read or write to the `user` or `project` configuration.
|
118
|
+
|
119
|
+
Configuration settings are read from environment variables, the user configuration file, the project configuration file (if present), and from the command line. The last value found takes precedence over values read earlier.
|
120
|
+
|
121
|
+
When writing to the configuration with the `config set` command, the new value is written to the project configuration file when executed within a project containing a translatomatic configuration file, or the user configuration file if there is no project configuration file.
|
122
|
+
|
123
|
+
### Translatomatic configuration examples
|
124
|
+
|
125
|
+
To set `google_api_key` within the user configuration file, use:
|
126
|
+
|
127
|
+
$ translatomatic config set google_api_key value --user
|
128
|
+
|
129
|
+
To set one or more translation services to use:
|
130
|
+
|
131
|
+
$ translatomatic config set provider Microsoft,Yandex
|
132
|
+
|
133
|
+
To set a default list of target locales:
|
134
|
+
|
135
|
+
$ translatomatic config set target_locales en,de,es,fr,it
|
136
|
+
|
137
|
+
With `target_locales` set, files can be translated without specifying target locales in the `translate file` command.
|
138
|
+
|
139
|
+
$ translatomatic translate file resources/strings.properties
|
140
|
+
|
141
|
+
To display the current configuration, execute:
|
142
|
+
|
143
|
+
$ translatomatic config list
|
144
|
+
|
145
|
+
### Database configuration
|
146
|
+
|
147
|
+
By default, `translatomatic` uses an sqlite3 database in `$HOME/.translatomatic/translatomatic.sqlite3` to store translated strings. The database configuration can be changed by creating a `database.yml` file under `$HOME/.translatomatic/database.yml` for the `production` environment, e.g.
|
148
|
+
|
149
|
+
production:
|
150
|
+
adapter: mysql2
|
151
|
+
host: db.example.com
|
152
|
+
database: translatomatic
|
153
|
+
pool: 5
|
154
|
+
encoding: utf8
|
155
|
+
collation: utf8_bin
|
156
|
+
username: username
|
157
|
+
password: password
|
158
|
+
|
159
|
+
* * *
|
160
|
+
|
161
|
+
## Contributing
|
162
|
+
|
163
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/smugglys/translatomatic. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
164
|
+
|
165
|
+
* * *
|
166
|
+
|
167
|
+
## License
|
168
|
+
|
169
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
170
|
+
|
171
|
+
* * *
|
172
|
+
|
173
|
+
## Code of Conduct
|
174
|
+
|
175
|
+
Everyone interacting with the Translatomatic projectâs codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/smugglys/translatomatic/blob/master/CODE_OF_CONDUCT.md).
|
176
|
+
|
177
|
+
_Created by Translatomatic 0.1.3 Tue, 06 Feb 2018 22:18:08 +1030 https://github.com/smugglys/translatomatic_
|
data/README.es.md
CHANGED
@@ -1,49 +1,49 @@
|
|
1
1
|
[](http://www.rubydoc.info/gems/translatomatic)[](https://badge.fury.io/rb/translatomatic)[](https://travis-ci.org/smugglys/translatomatic)[](https://codeclimate.com/github/smugglys/translatomatic)
|
2
2
|
|
3
|
-
#
|
3
|
+
# Translatomático
|
4
4
|
|
5
|
-
Traduce archivos de texto de un idioma a otro, o de un formato a otro.
|
5
|
+
Traduce archivos de texto de un idioma a otro, o de un formato a otro. Los siguientes formatos de archivo son compatibles actualmente:
|
6
6
|
|
7
7
|
| Formato de archivo | Extensiones |
|
8
8
|
| --- | --- |
|
9
9
|
| [Propiedades](https://en.wikipedia.org/wiki/.properties) | `.properties` |
|
10
10
|
| Archivos de recursos de Windows | `.resw, .resx` |
|
11
|
-
| [
|
11
|
+
| [Listas de propiedades](https://en.wikipedia.org/wiki/Property_list) (OSX plist) | `.plist` |
|
12
12
|
| [Archivos PO](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) | `.po, .pot` |
|
13
|
-
| [XCode
|
13
|
+
| [Cadenas de XCode](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html) | `.strings` |
|
14
14
|
| [YAML](http://yaml.org/) | `.yaml` |
|
15
15
|
| Subtítulos | `.srt, .ass, .ssa` |
|
16
16
|
| HTML | `.html, .htm, .shtml` |
|
17
17
|
| XML | `.xml` |
|
18
|
-
| [
|
19
|
-
|
|
18
|
+
| [Reducción](https://en.wikipedia.org/wiki/Markdown) | `.md` |
|
19
|
+
| Archivos de texto | `.txt` |
|
20
20
|
| Archivos CSV | `.csv` |
|
21
21
|
|
22
|
-
|
22
|
+
Los siguientes proveedores de traducción se pueden usar con Translatomatic:
|
23
23
|
|
24
24
|
- [Google](https://cloud.google.com/translate/)
|
25
25
|
- [Microsoft](https://www.microsoft.com/en-us/translator/translatorapi.aspx)
|
26
26
|
- [Yandex](https://tech.yandex.com/translate/)
|
27
|
-
- [
|
28
|
-
- [
|
27
|
+
- [Mi memoria](https://mymemory.translated.net/doc/)
|
28
|
+
- [Frenéticamente](http://www.frengly.com/api)
|
29
29
|
|
30
|
-
|
30
|
+
Las cadenas traducidas se guardan en una base de datos y se vuelven a usar.
|
31
31
|
|
32
32
|
* * *
|
33
33
|
|
34
34
|
## Instalación
|
35
35
|
|
36
|
-
|
36
|
+
Agregue esta línea a su aplicación `Gemfile`:
|
37
37
|
|
38
38
|
`ruby
|
39
39
|
gem 'translatomatic'
|
40
40
|
`
|
41
41
|
|
42
|
-
Y
|
42
|
+
Y luego ejecuta:
|
43
43
|
|
44
44
|
$ bundle
|
45
45
|
|
46
|
-
O
|
46
|
+
O instálelo usted mismo como:
|
47
47
|
|
48
48
|
$ gem install translatomatic
|
49
49
|
|
@@ -51,60 +51,60 @@ O instalar usted mismo como:
|
|
51
51
|
|
52
52
|
## Uso
|
53
53
|
|
54
|
-
Esta gema
|
54
|
+
Esta gema proporciona un ejecutable llamado `translatomatic`. los `translatomatic` comando tiene una serie de funciones, no todas documentadas aquí. Para obtener ayuda sobre los comandos y opciones disponibles, ejecute:
|
55
55
|
|
56
56
|
$ translatomatic help
|
57
57
|
|
58
|
-
Y para obtener ayuda
|
58
|
+
Y para obtener ayuda con un comando, ejecuta:
|
59
59
|
|
60
60
|
$ translatomatic translate help
|
61
61
|
$ translatomatic translate help file
|
62
62
|
|
63
63
|
* * *
|
64
64
|
|
65
|
-
##
|
65
|
+
## Preparar
|
66
66
|
|
67
|
-
|
67
|
+
Verifique los proveedores y opciones de traducción disponibles con el `providers` mando:
|
68
68
|
|
69
|
-
$ translatomatic
|
69
|
+
$ translatomatic providers
|
70
70
|
|
71
|
-
|
71
|
+
Las opciones se pueden especificar en la línea de comando, en variables de entorno o en los archivos de configuración de translatomatic. Los archivos de configuración se pueden modificar usando el interno de translatomatic `config` mando. Para enumerar todas las configuraciones de configuración disponibles, use:
|
72
72
|
|
73
73
|
$ translatomatic config list
|
74
74
|
$ translatomatic config describe
|
75
75
|
|
76
|
-
|
76
|
+
Las opciones se pueden configurar a nivel del usuario o del proyecto. Consulte también la sección Configuración a continuación para obtener más información.
|
77
77
|
|
78
78
|
* * *
|
79
79
|
|
80
|
-
##
|
80
|
+
## Traducción de archivos
|
81
81
|
|
82
|
-
|
82
|
+
Al traducir archivos, `translatomatic` traduce texto una oración o frase a la vez. Si se vuelve a traducir un archivo, solo las oraciones que han cambiado desde la última traducción se envían al proveedor de la traducción, y el resto se obtienen de la base de datos local.
|
83
83
|
|
84
|
-
Para traducir un archivo de propiedades de Java
|
84
|
+
Para traducir un archivo de propiedades de Java a alemán y francés utilizando el proveedor de Google:
|
85
85
|
|
86
|
-
$ translatomatic translate file --
|
86
|
+
$ translatomatic translate file --provider Google strings.properties de,fr
|
87
87
|
|
88
|
-
Esto
|
88
|
+
Esto crearía (o sobrescribiría) `strings_de.properties` y `strings_fr.properties` con propiedades traducidas
|
89
89
|
|
90
|
-
###
|
90
|
+
### Mostrar cadenas desde un paquete de recursos
|
91
91
|
|
92
92
|
Para leer y mostrar el `store.description` y `store.name` propiedades de los archivos de recursos locales en inglés, alemán y francés:
|
93
93
|
|
94
94
|
$ translatomatic display --locales=en,de,fr \
|
95
95
|
resources/strings.properties store.description store.name
|
96
96
|
|
97
|
-
###
|
97
|
+
### Extracción de cadenas de archivos de origen
|
98
98
|
|
99
|
-
Para extraer
|
99
|
+
Para extraer cadenas de archivos fuente, use el `strings` comando, por ejemplo
|
100
100
|
|
101
101
|
$ translatomatic strings file.rb
|
102
102
|
|
103
103
|
* * *
|
104
104
|
|
105
|
-
##
|
105
|
+
## Convertir archivos
|
106
106
|
|
107
|
-
Translatomatic se puede
|
107
|
+
Translatomatic se puede usar para convertir archivos de un formato a otro. Por ejemplo, para convertir un archivo de propiedades de Java en un archivo de cadenas de XCode:
|
108
108
|
|
109
109
|
$ translatomatic convert strings.properties Localization.strings
|
110
110
|
|
@@ -112,35 +112,39 @@ Translatomatic se puede utilizar para convertir archivos de un formato a otro. P
|
|
112
112
|
|
113
113
|
## Configuración
|
114
114
|
|
115
|
-
|
115
|
+
La configuración de configuración se puede leer y escribir usando `config get` y `config set` comandos. Translatomatic utiliza un archivo de configuración de usuario en `$HOME/.translatomatic/config.yml`y, opcionalmente, un archivo de configuración de proyecto `$PROJECT_DIR/.translatomatic/config.yml`.
|
116
116
|
|
117
|
-
|
117
|
+
los `--user` y `--project` Las opciones se pueden usar para indicar al comando que lea o escriba en el `user` o `project` configuración.
|
118
118
|
|
119
|
-
|
119
|
+
Las configuraciones de configuración se leen desde variables de entorno, el archivo de configuración del usuario, el archivo de configuración del proyecto (si está presente) y desde la línea de comando. El último valor encontrado tiene prioridad sobre los valores leídos anteriormente.
|
120
120
|
|
121
|
-
|
121
|
+
Al escribir en la configuración con el `config set` comando, el nuevo valor se escribe en el archivo de configuración del proyecto cuando se ejecuta dentro de un proyecto que contiene un archivo de configuración translatomático, o el archivo de configuración del usuario si no hay un archivo de configuración del proyecto.
|
122
122
|
|
123
|
-
|
123
|
+
### Ejemplos de configuración translatomática
|
124
124
|
|
125
|
-
|
125
|
+
Para establecer `google_api_key` dentro del archivo de configuración del usuario, use:
|
126
126
|
|
127
|
-
|
127
|
+
$ translatomatic config set google_api_key value --user
|
128
128
|
|
129
|
-
Para
|
129
|
+
Para configurar uno o más servicios de traducción para usar:
|
130
|
+
|
131
|
+
$ translatomatic config set provider Microsoft,Yandex
|
132
|
+
|
133
|
+
Para establecer una lista predeterminada de configuraciones regionales de destino:
|
130
134
|
|
131
135
|
$ translatomatic config set target_locales en,de,es,fr,it
|
132
136
|
|
133
|
-
Con `target_locales`
|
137
|
+
Con `target_locales` establecer, los archivos se pueden traducir sin especificar las configuraciones regionales de destino en `translate file` mando.
|
134
138
|
|
135
139
|
$ translatomatic translate file resources/strings.properties
|
136
140
|
|
137
|
-
Para mostrar la configuración actual,
|
141
|
+
Para mostrar la configuración actual, ejecute:
|
138
142
|
|
139
143
|
$ translatomatic config list
|
140
144
|
|
141
|
-
### Configuración de base
|
145
|
+
### Configuración de la base
|
142
146
|
|
143
|
-
Por defecto, `translatomatic` utiliza una base de datos sqlite3 en `$HOME/.translatomatic/translatomatic.sqlite3` para almacenar cadenas traducidas
|
147
|
+
Por defecto, `translatomatic` utiliza una base de datos sqlite3 en `$HOME/.translatomatic/translatomatic.sqlite3` para almacenar cadenas traducidas La configuración de la base de datos se puede cambiar creando un `database.yml` archivo debajo `$HOME/.translatomatic/database.yml` Para el `production` medio ambiente, por ejemplo
|
144
148
|
|
145
149
|
production:
|
146
150
|
adapter: mysql2
|
@@ -148,6 +152,7 @@ Por defecto, `translatomatic` utiliza una base de datos sqlite3 en `$HOME/.trans
|
|
148
152
|
database: translatomatic
|
149
153
|
pool: 5
|
150
154
|
encoding: utf8
|
155
|
+
collation: utf8_bin
|
151
156
|
username: username
|
152
157
|
password: password
|
153
158
|
|
@@ -155,18 +160,18 @@ Por defecto, `translatomatic` utiliza una base de datos sqlite3 en `$HOME/.trans
|
|
155
160
|
|
156
161
|
## Contribuyendo
|
157
162
|
|
158
|
-
Los informes de
|
163
|
+
Los informes de errores y las solicitudes de extracción son bienvenidos en GitHub en https://github.com/smugglys/translatomatic. Este proyecto pretende ser un espacio seguro y acogedor para la colaboración, y se espera que los contribuyentes se adhieran a la [Pacto del colaborador](http://contributor-covenant.org) código de Conducta.
|
159
164
|
|
160
165
|
* * *
|
161
166
|
|
162
|
-
##
|
167
|
+
## License
|
163
168
|
|
164
|
-
La
|
169
|
+
La gema está disponible como fuente abierta bajo los términos de la [Licencia MIT](https://opensource.org/licenses/MIT).
|
165
170
|
|
166
171
|
* * *
|
167
172
|
|
168
|
-
## Código de
|
173
|
+
## Código de Conducta
|
169
174
|
|
170
|
-
|
175
|
+
Se espera que todos los que interactúan con las bases de código del proyecto Translatomatic, los rastreadores de problemas, las salas de chat y las listas de correo sigan el [código de Conducta](https://github.com/smugglys/translatomatic/blob/master/CODE_OF_CONDUCT.md).
|
171
176
|
|
172
|
-
_Creado por Translatomatic 0.1.
|
177
|
+
_Creado por Translatomatic 0.1.3 Tue, 06 Feb 2018 22:18:12 +1030 https://github.com/smugglys/translatomatic_
|
data/README.fr.md
CHANGED
@@ -1,33 +1,33 @@
|
|
1
1
|
[](http://www.rubydoc.info/gems/translatomatic)[](https://badge.fury.io/rb/translatomatic)[](https://travis-ci.org/smugglys/translatomatic)[](https://codeclimate.com/github/smugglys/translatomatic)
|
2
2
|
|
3
|
-
#
|
3
|
+
# Translatomatique
|
4
4
|
|
5
|
-
|
5
|
+
Traduit des fichiers texte d'une langue à une autre ou d'un format à un autre. Les formats de fichiers suivants sont actuellement supportés:
|
6
6
|
|
7
7
|
| Format de fichier | Extensions |
|
8
8
|
| --- | --- |
|
9
9
|
| [Propriétés](https://en.wikipedia.org/wiki/.properties) | `.properties` |
|
10
|
-
| Fichiers de ressources
|
11
|
-
| [
|
10
|
+
| Fichiers de ressources Windows | `.resw, .resx` |
|
11
|
+
| [Listes de propriétés](https://en.wikipedia.org/wiki/Property_list) (OSX plist) | `.plist` |
|
12
12
|
| [Fichiers PO](https://www.gnu.org/software/gettext/manual/html_node/PO-Files.html) | `.po, .pot` |
|
13
|
-
| [XCode
|
13
|
+
| [Chaînes XCode](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html) | `.strings` |
|
14
14
|
| [YAML](http://yaml.org/) | `.yaml` |
|
15
|
-
|
|
15
|
+
| Les sous-titres | `.srt, .ass, .ssa` |
|
16
16
|
| HTML | `.html, .htm, .shtml` |
|
17
17
|
| XML | `.xml` |
|
18
|
-
| [
|
19
|
-
|
|
18
|
+
| [Réduction](https://en.wikipedia.org/wiki/Markdown) | `.md` |
|
19
|
+
| Fichiers texte | `.txt` |
|
20
20
|
| Fichiers CSV | `.csv` |
|
21
21
|
|
22
|
-
|
22
|
+
Les fournisseurs de traduction suivants peuvent être utilisés avec Translatomatic:
|
23
23
|
|
24
24
|
- [Google](https://cloud.google.com/translate/)
|
25
25
|
- [Microsoft](https://www.microsoft.com/en-us/translator/translatorapi.aspx)
|
26
26
|
- [Yandex](https://tech.yandex.com/translate/)
|
27
|
-
- [
|
27
|
+
- [Ma mémoire](https://mymemory.translated.net/doc/)
|
28
28
|
- [Frengly](http://www.frengly.com/api)
|
29
29
|
|
30
|
-
Les chaînes traduites sont
|
30
|
+
Les chaînes traduites sont enregistrées dans une base de données et réutilisées.
|
31
31
|
|
32
32
|
* * *
|
33
33
|
|
@@ -39,72 +39,72 @@ Ajoutez cette ligne à votre application `Gemfile`:
|
|
39
39
|
gem 'translatomatic'
|
40
40
|
`
|
41
41
|
|
42
|
-
Et puis
|
42
|
+
Et puis exécutez:
|
43
43
|
|
44
44
|
$ bundle
|
45
45
|
|
46
|
-
Ou installez-le vous-même:
|
46
|
+
Ou installez-le vous-même en tant que:
|
47
47
|
|
48
48
|
$ gem install translatomatic
|
49
49
|
|
50
50
|
* * *
|
51
51
|
|
52
|
-
##
|
52
|
+
## Usage
|
53
53
|
|
54
|
-
|
54
|
+
Cette gemme fournit un exécutable appelé `translatomatic`. le `translatomatic` La commande a un certain nombre de fonctions, qui ne sont pas toutes documentées ici. Pour obtenir de l'aide sur les commandes et les options disponibles, exécutez:
|
55
55
|
|
56
56
|
$ translatomatic help
|
57
57
|
|
58
|
-
Et de l
|
58
|
+
Et pour obtenir de l'aide sur une commande, exécutez:
|
59
59
|
|
60
60
|
$ translatomatic translate help
|
61
61
|
$ translatomatic translate help file
|
62
62
|
|
63
63
|
* * *
|
64
64
|
|
65
|
-
##
|
65
|
+
## Installer
|
66
66
|
|
67
|
-
|
67
|
+
Vérifiez les fournisseurs de traduction et les options disponibles avec `providers` commander:
|
68
68
|
|
69
|
-
$ translatomatic
|
69
|
+
$ translatomatic providers
|
70
70
|
|
71
|
-
|
71
|
+
Les options peuvent être spécifiées sur la ligne de commande, dans les variables d'environnement ou dans les fichiers de configuration de translatomatic. Les fichiers de configuration peuvent être modifiés à l'aide de la commande interne de translatomatic `config` commander. Pour répertorier tous les paramètres de configuration disponibles, utilisez:
|
72
72
|
|
73
73
|
$ translatomatic config list
|
74
74
|
$ translatomatic config describe
|
75
75
|
|
76
|
-
|
76
|
+
Les options peuvent être définies au niveau de l'utilisateur ou au niveau du projet. Voir aussi la section Configuration ci-dessous pour plus d'informations.
|
77
77
|
|
78
78
|
* * *
|
79
79
|
|
80
|
-
## Traduction
|
80
|
+
## Traduction de fichiers
|
81
81
|
|
82
|
-
Lors de la
|
82
|
+
Lors de la traduction de fichiers, `translatomatic` traduit le texte d'une phrase ou d'une phrase à la fois. Si un fichier est re-traduit, seules les phrases qui ont été modifiées depuis la dernière traduction sont envoyées au fournisseur de traduction, et les autres proviennent de la base de données locale.
|
83
83
|
|
84
|
-
Pour traduire un fichier de propriétés Java allemand et
|
84
|
+
Pour traduire un fichier de propriétés Java en allemand et en français à l'aide du fournisseur Google:
|
85
85
|
|
86
|
-
$ translatomatic translate file --
|
86
|
+
$ translatomatic translate file --provider Google strings.properties de,fr
|
87
87
|
|
88
|
-
Cela
|
88
|
+
Cela créerait (ou écraserait) `strings_de.properties` et `strings_fr.properties` avec des propriétés traduites.
|
89
89
|
|
90
|
-
###
|
90
|
+
### Affichage des chaînes d'un regroupement de ressources
|
91
91
|
|
92
|
-
Pour lire et afficher le `store.description` et `store.name` propriétés à partir
|
92
|
+
Pour lire et afficher le `store.description` et `store.name` propriétés à partir de fichiers de ressources locaux en anglais, allemand et français:
|
93
93
|
|
94
94
|
$ translatomatic display --locales=en,de,fr \
|
95
95
|
resources/strings.properties store.description store.name
|
96
96
|
|
97
|
-
###
|
97
|
+
### Extraire des chaînes de fichiers sources
|
98
98
|
|
99
|
-
|
99
|
+
Pour extraire des chaînes de fichiers source, utilisez le `strings` commande, par exemple
|
100
100
|
|
101
101
|
$ translatomatic strings file.rb
|
102
102
|
|
103
103
|
* * *
|
104
104
|
|
105
|
-
##
|
105
|
+
## Conversion de fichiers
|
106
106
|
|
107
|
-
Translatomatic peut être utilisé pour convertir des fichiers d
|
107
|
+
Translatomatic peut être utilisé pour convertir des fichiers d'un format à un autre. Par exemple, pour convertir un fichier de propriétés Java en un fichier de chaînes XCode:
|
108
108
|
|
109
109
|
$ translatomatic convert strings.properties Localization.strings
|
110
110
|
|
@@ -112,35 +112,39 @@ Translatomatic peut être utilisé pour convertir des fichiers d’un format à
|
|
112
112
|
|
113
113
|
## Configuration
|
114
114
|
|
115
|
-
|
115
|
+
Les paramètres de configuration peuvent être lus et écrits en utilisant `config get` et `config set` commandes. Translatomatic utilise un fichier de configuration utilisateur à `$HOME/.translatomatic/config.yml`, et éventuellement un fichier de configuration par projet `$PROJECT_DIR/.translatomatic/config.yml`.
|
116
116
|
|
117
|
-
|
117
|
+
le `--user` et `--project` les options peuvent être utilisées pour dire à la commande de lire ou d'écrire à la `user` ou `project` configuration.
|
118
118
|
|
119
|
-
|
119
|
+
Les paramètres de configuration sont lus à partir des variables d'environnement, du fichier de configuration de l'utilisateur, du fichier de configuration du projet (le cas échéant) et de la ligne de commande. La dernière valeur trouvée a priorité sur les valeurs lues plus tôt.
|
120
120
|
|
121
|
-
|
121
|
+
En écrivant à la configuration avec le `config set` commande, la nouvelle valeur est écrite dans le fichier de configuration du projet lorsqu'elle est exécutée dans un projet contenant un fichier de configuration translatomatique ou dans le fichier de configuration utilisateur s'il n'y a pas de fichier de configuration de projet.
|
122
122
|
|
123
|
-
|
123
|
+
### Exemples de configuration translatomatique
|
124
124
|
|
125
|
-
|
125
|
+
Mettre en place `google_api_key` dans le fichier de configuration de l'utilisateur, utilisez:
|
126
126
|
|
127
|
-
|
127
|
+
$ translatomatic config set google_api_key value --user
|
128
128
|
|
129
|
-
Pour définir
|
129
|
+
Pour définir un ou plusieurs services de traduction à utiliser:
|
130
|
+
|
131
|
+
$ translatomatic config set provider Microsoft,Yandex
|
132
|
+
|
133
|
+
Pour définir une liste par défaut des paramètres régionaux cibles:
|
130
134
|
|
131
135
|
$ translatomatic config set target_locales en,de,es,fr,it
|
132
136
|
|
133
|
-
Avec `target_locales`
|
137
|
+
Avec `target_locales` ensemble, les fichiers peuvent être traduits sans spécifier de paramètres régionaux cibles dans le `translate file` commander.
|
134
138
|
|
135
139
|
$ translatomatic translate file resources/strings.properties
|
136
140
|
|
137
|
-
Pour afficher la configuration actuelle, exécutez
|
141
|
+
Pour afficher la configuration actuelle, exécutez:
|
138
142
|
|
139
143
|
$ translatomatic config list
|
140
144
|
|
141
|
-
### Configuration de la base
|
145
|
+
### Configuration de la base
|
142
146
|
|
143
|
-
Par défaut, `translatomatic` utilise une base de données sqlite3 dans `$HOME/.translatomatic/translatomatic.sqlite3` pour stocker
|
147
|
+
Par défaut, `translatomatic` utilise une base de données sqlite3 dans `$HOME/.translatomatic/translatomatic.sqlite3` pour stocker les chaînes traduites. La configuration de la base de données peut être modifiée en créant un `database.yml` fichier sous `$HOME/.translatomatic/database.yml` pour le `production` environnement, par exemple
|
144
148
|
|
145
149
|
production:
|
146
150
|
adapter: mysql2
|
@@ -148,6 +152,7 @@ Par défaut, `translatomatic` utilise une base de données sqlite3 dans `$HOME/.
|
|
148
152
|
database: translatomatic
|
149
153
|
pool: 5
|
150
154
|
encoding: utf8
|
155
|
+
collation: utf8_bin
|
151
156
|
username: username
|
152
157
|
password: password
|
153
158
|
|
@@ -155,18 +160,18 @@ Par défaut, `translatomatic` utilise une base de données sqlite3 dans `$HOME/.
|
|
155
160
|
|
156
161
|
## Contribuant
|
157
162
|
|
158
|
-
Les rapports de bogues et
|
163
|
+
Les rapports de bogues et les demandes d'extraction sont les bienvenus sur GitHub à l'adresse https://github.com/smugglys/translatomatic. Ce projet se veut un espace de collaboration sûr et accueillant, et les contributeurs sont tenus de respecter les [Contributeur](http://contributor-covenant.org) code de conduite.
|
159
164
|
|
160
165
|
* * *
|
161
166
|
|
162
167
|
## Licence
|
163
168
|
|
164
|
-
|
169
|
+
La gemme est disponible en open source selon les termes de la [MIT Licence](https://opensource.org/licenses/MIT).
|
165
170
|
|
166
171
|
* * *
|
167
172
|
|
168
173
|
## Code de conduite
|
169
174
|
|
170
|
-
Tout le monde
|
175
|
+
Tout le monde qui interagit avec les bases de code du projet Translatomatic, les traqueurs de problèmes, les forums de discussion et les listes de diffusion devrait suivre [code de conduite](https://github.com/smugglys/translatomatic/blob/master/CODE_OF_CONDUCT.md).
|
171
176
|
|
172
|
-
_Créé par Translatomatic 0.1.
|
177
|
+
_Créé par Translatomatic 0.1.3 Tue, 06 Feb 2018 22:18:15 +1030 https://github.com/smugglys/translatomatic_
|