translatomatic 0.1.0 → 0.1.1

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.
Files changed (67) hide show
  1. checksums.yaml +5 -5
  2. data/.gitattributes +1 -0
  3. data/.gitignore +15 -12
  4. data/.rspec +3 -3
  5. data/.travis.yml +32 -50
  6. data/CODE_OF_CONDUCT.md +74 -74
  7. data/Gemfile +29 -5
  8. data/Guardfile +48 -0
  9. data/LICENSE.txt +21 -21
  10. data/README.de.md +92 -0
  11. data/README.es.md +92 -0
  12. data/README.fr.md +92 -0
  13. data/README.it.md +92 -0
  14. data/README.ja.md +92 -0
  15. data/README.md +96 -74
  16. data/Rakefile +6 -6
  17. data/bin/setup +8 -8
  18. data/bin/translatomatic +6 -6
  19. data/bin/travis +26 -0
  20. data/db/database.yml +9 -9
  21. data/db/migrate/201712170000_initial.rb +24 -23
  22. data/lib/translatomatic/cli.rb +204 -80
  23. data/lib/translatomatic/config.rb +12 -26
  24. data/lib/translatomatic/converter.rb +206 -142
  25. data/lib/translatomatic/converter_stats.rb +27 -27
  26. data/lib/translatomatic/database.rb +139 -99
  27. data/lib/translatomatic/escaped_unicode.rb +90 -90
  28. data/lib/translatomatic/extractor/base.rb +14 -0
  29. data/lib/translatomatic/extractor/ruby.rb +5 -0
  30. data/lib/translatomatic/extractor.rb +4 -0
  31. data/lib/translatomatic/http_request.rb +133 -0
  32. data/lib/translatomatic/locale.rb +52 -0
  33. data/lib/translatomatic/logger.rb +28 -0
  34. data/lib/translatomatic/model/locale.rb +21 -22
  35. data/lib/translatomatic/model/text.rb +17 -13
  36. data/lib/translatomatic/model.rb +4 -4
  37. data/lib/translatomatic/option.rb +24 -24
  38. data/lib/translatomatic/progress_updater.rb +15 -0
  39. data/lib/translatomatic/resource_file/base.rb +169 -137
  40. data/lib/translatomatic/resource_file/html.rb +46 -28
  41. data/lib/translatomatic/resource_file/markdown.rb +54 -0
  42. data/lib/translatomatic/resource_file/plist.rb +30 -29
  43. data/lib/translatomatic/resource_file/properties.rb +72 -60
  44. data/lib/translatomatic/resource_file/resw.rb +30 -0
  45. data/lib/translatomatic/resource_file/text.rb +29 -28
  46. data/lib/translatomatic/resource_file/xcode_strings.rb +71 -65
  47. data/lib/translatomatic/resource_file/xml.rb +79 -59
  48. data/lib/translatomatic/resource_file/yaml.rb +82 -80
  49. data/lib/translatomatic/resource_file.rb +76 -74
  50. data/lib/translatomatic/string.rb +160 -0
  51. data/lib/translatomatic/tmx/document.rb +100 -0
  52. data/lib/translatomatic/tmx/translation_unit.rb +19 -0
  53. data/lib/translatomatic/tmx.rb +4 -0
  54. data/lib/translatomatic/translation_result.rb +75 -57
  55. data/lib/translatomatic/translator/base.rb +83 -47
  56. data/lib/translatomatic/translator/frengly.rb +57 -64
  57. data/lib/translatomatic/translator/google.rb +31 -30
  58. data/lib/translatomatic/translator/microsoft.rb +33 -32
  59. data/lib/translatomatic/translator/my_memory.rb +64 -55
  60. data/lib/translatomatic/translator/yandex.rb +39 -37
  61. data/lib/translatomatic/translator.rb +63 -63
  62. data/lib/translatomatic/util.rb +15 -24
  63. data/lib/translatomatic/version.rb +4 -3
  64. data/lib/translatomatic.rb +32 -27
  65. data/translatomatic.gemspec +43 -45
  66. metadata +52 -18
  67. data/Gemfile.lock +0 -137
data/README.fr.md ADDED
@@ -0,0 +1,92 @@
1
+ [![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/translatomatic)[![Gem Version](https://badge.fury.io/rb/translatomatic.svg)](https://badge.fury.io/rb/translatomatic)[![Build Status](https://travis-ci.org/smugglys/translatomatic.svg?branch=master)](https://travis-ci.org/smugglys/translatomatic)[![Code Climate](https://codeclimate.com/github/smugglys/translatomatic.svg)](https://codeclimate.com/github/smugglys/translatomatic)
2
+
3
+ # Translatomatic
4
+
5
+ Convertit des fichiers à partir d'une langue à l'autre. Les formats de fichier suivantssont actuellement pris en charge::
6
+
7
+ - [Propriétés](https://en.wikipedia.org/wiki/.properties)
8
+ - RESW (ressources Windows fichier)
9
+ - [Les listes des propriétés de](https://en.wikipedia.org/wiki/Property_list) (OSX plist)
10
+ - HTML
11
+ - XML
12
+ - [XCode chaînes](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html)
13
+ - [YAML](http://yaml.org/)
14
+ - Les fichiers texte
15
+
16
+ Les chaînes traduites sont enregistrés dans une base de données et de les réutiliser.
17
+
18
+ ## Installation
19
+
20
+ Ajoutez cette ligne à votre application `Gemfile`:
21
+
22
+ `ruby
23
+ gem 'translatomatic'
24
+ `
25
+
26
+ Et puis de l'exécuter:
27
+
28
+ $ bundle
29
+
30
+ Ou installez-le vous-même:
31
+
32
+ $ gem install translatomatic
33
+
34
+ ## L'utilisation de la
35
+
36
+ L'interface de ligne de commande pour la fonctionnalité de traduction est `translatomatic`. Pour obtenir de l'aide sur les options disponibles, exécutez:
37
+
38
+ $ translatomatic help
39
+
40
+ ### Traduction de fichiers
41
+
42
+ `translatomatic` traduire un texte d'une phrase ou d'une phrase à la fois. Si un fichier est re-traduit, seules les peines qui ont été modifiés sont envoyés pour le traducteur, et le reste sont obtenus à partir de la base de données locale.
43
+
44
+ Pour une liste des services de traduction et d'options:
45
+
46
+ $ translatomatic translators
47
+
48
+ Pour traduire un fichier de propriétés Java pour l'allemand et le français:
49
+
50
+ $ translatomatic translate resources/strings.properties de fr
51
+
52
+ Cela permettrait de créer (ou écraser) `strings_de.properties` et `strings_fr.properties`.
53
+
54
+ ### L'extraction de chaînes à partir de fichiers source
55
+
56
+ Pour extraire les chaînes de certains fichiers source, utilisez la commande extraire, par exemple
57
+
58
+ $ translatomatic strings file.rb
59
+
60
+ ### L'affichage des chaînes de caractères à partir d'un regroupement de ressources
61
+
62
+ Pour lire et afficher le `store.description` et `store.name` propriétés à partir des fichiers de ressources locales en anglais, en allemand et en français:
63
+
64
+ $ translatomatic display --locales=en,de,fr \
65
+ resources/strings.properties store.description store.name
66
+
67
+ ## Configuration
68
+
69
+ Par défaut, `translatomatic` utilise une base de données sqlite3 dans `$HOME/.translatomatic/translatomatic.sqlite3` pour stocker des chaînes traduites. La base de données peut être modifié par la création d'un `database.yml` fichier sous `$HOME/.translatomatic/database.yml` pour l' `production` l'environnement, par exemple
70
+
71
+ production:
72
+ adapter: mysql2
73
+ host: db.example.com
74
+ database: translatomatic
75
+ pool: 5
76
+ encoding: utf8
77
+ username: username
78
+ password: password
79
+
80
+ ## Contribuer
81
+
82
+ Les rapports de bogues et de tirer les demandes sont les bienvenus sur GitHub à https://github.com/smugglys/translatomatic. Ce projet est destiné à être un coffre-fort, espace accueillant pour la collaboration, et les contributeurs sont tenus de se conformer à la [Contributeur Pacte](http://contributor-covenant.org) code de conduite.
83
+
84
+ ## Licence
85
+
86
+ Le bijou est disponible en open source sous les termes de la [Licence MIT](https://opensource.org/licenses/MIT).
87
+
88
+ ## Code de Conduite
89
+
90
+ Tout le monde l'interaction avec le Translatomatic projet de code, la question des trackers, des salles de discussion et listes de diffusion, il est prévu de suivre l' [code de conduite](https://github.com/smugglys/translatomatic/blob/master/CODE_OF_CONDUCT.md).
91
+
92
+ _Created by Translatomatic 0.1.0 2017-12-28 22:45_
data/README.it.md ADDED
@@ -0,0 +1,92 @@
1
+ [![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/translatomatic)[![Gem Version](https://badge.fury.io/rb/translatomatic.svg)](https://badge.fury.io/rb/translatomatic)[![Build Status](https://travis-ci.org/smugglys/translatomatic.svg?branch=master)](https://travis-ci.org/smugglys/translatomatic)[![Code Climate](https://codeclimate.com/github/smugglys/translatomatic.svg)](https://codeclimate.com/github/smugglys/translatomatic)
2
+
3
+ # Translatomatic
4
+
5
+ Converte file di testo da una lingua all'altra. I seguenti formati di filesono attualmente supportati::
6
+
7
+ - [Proprietà](https://en.wikipedia.org/wiki/.properties)
8
+ - RESW (risorse di Windows, file)
9
+ - [Elenchi di proprietà](https://en.wikipedia.org/wiki/Property_list) (OSX plist)
10
+ - HTML
11
+ - XML
12
+ - [XCode stringhe](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html)
13
+ - [YAML](http://yaml.org/)
14
+ - I file di testo
15
+
16
+ Tradotto le stringhe vengono salvati in un database e riutilizzati.
17
+
18
+ ## Installazione
19
+
20
+ Aggiungere questa riga al file dell'applicazione `Gemfile`:
21
+
22
+ `ruby
23
+ gem 'translatomatic'
24
+ `
25
+
26
+ E poi eseguire:
27
+
28
+ $ bundle
29
+
30
+ O installare da soli come:
31
+
32
+ $ gem install translatomatic
33
+
34
+ ## Utilizzo
35
+
36
+ L'interfaccia a riga di comando per la traduzione funzionalità `translatomatic`. Per la guida sulle opzioni disponibili, eseguire:
37
+
38
+ $ translatomatic help
39
+
40
+ ### La traduzione di file
41
+
42
+ `translatomatic` traduce il testo una frase o una frase alla volta. Se un file è ri-tradotto, solo frasi che hanno cambiato inviati al traduttore, e il resto provengono dalla banca dati locale.
43
+
44
+ Elenco di servizi di traduzione ed opzioni:
45
+
46
+ $ translatomatic translators
47
+
48
+ Per tradurre un file delle proprietà Java per il tedesco e il francese:
49
+
50
+ $ translatomatic translate resources/strings.properties de fr
51
+
52
+ Questo permetterebbe di creare (o sovrascrivere) `strings_de.properties` e `strings_fr.properties`.
53
+
54
+ ### Estrarre le stringhe dal file di origine
55
+
56
+ Per estrarre le stringhe da alcuni file di origine, utilizzare il comando di estrazione, ad es.
57
+
58
+ $ translatomatic strings file.rb
59
+
60
+ ### Visualizzazione di stringhe da un pacchetto di risorse
61
+
62
+ Per leggere e visualizzare il `store.description` e `store.name` proprietà dal file di risorse locali in inglese, tedesco e francese:
63
+
64
+ $ translatomatic display --locales=en,de,fr \
65
+ resources/strings.properties store.description store.name
66
+
67
+ ## Configurazione
68
+
69
+ Per impostazione predefinita, `translatomatic` utilizza un database sqlite3 in `$HOME/.translatomatic/translatomatic.sqlite3` per memorizzare stringhe tradotte. Il database può essere modificato con la creazione di un `database.yml` file sotto `$HOME/.translatomatic/database.yml` per il `production` ambiente, ad es.
70
+
71
+ production:
72
+ adapter: mysql2
73
+ host: db.example.com
74
+ database: translatomatic
75
+ pool: 5
76
+ encoding: utf8
77
+ username: username
78
+ password: password
79
+
80
+ ## Contribuire
81
+
82
+ Le segnalazioni di Bug e tirare le richieste sono i benvenuti su GitHub a https://github.com/smugglys/translatomatic. Questo progetto è destinato ad essere un sicuro e accogliente spazio per la collaborazione, e i collaboratori sono tenuti a rispettare i [Collaboratore Alleanza](http://contributor-covenant.org) codice di condotta.
83
+
84
+ ## Licenza
85
+
86
+ Il gioiello è disponibile come open source sotto i termini della [La Licenza MIT](https://opensource.org/licenses/MIT).
87
+
88
+ ## Codice di Condotta
89
+
90
+ Tutti interagendo con il Translatomatic progetto di basi di codice, issue tracker, chat e mailing list dovrebbe seguire l' [codice di condotta](https://github.com/smugglys/translatomatic/blob/master/CODE_OF_CONDUCT.md).
91
+
92
+ _Created by Translatomatic 0.1.0 2017-12-29 00:07_
data/README.ja.md ADDED
@@ -0,0 +1,92 @@
1
+ [![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/translatomatic)[![Gem Version](https://badge.fury.io/rb/translatomatic.svg)](https://badge.fury.io/rb/translatomatic)[![Build Status](https://travis-ci.org/smugglys/translatomatic.svg?branch=master)](https://travis-ci.org/smugglys/translatomatic)[![Code Climate](https://codeclimate.com/github/smugglys/translatomatic.svg)](https://codeclimate.com/github/smugglys/translatomatic)
2
+
3
+ # Translatomatic
4
+
5
+ 変換テキストファイルから一言語ます。 以下のファイル形式は現在サポートされているのは、:
6
+
7
+ - [特性](https://en.wikipedia.org/wiki/.properties)
8
+ - RESW(Windows資源ファイル)
9
+ - [物件リスト](https://en.wikipedia.org/wiki/Property_list) (OSX plist)
10
+ - HTML
11
+ - XML
12
+ - [XCodeの文字列](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html)
13
+ - [YAML](http://yaml.org/)
14
+ - テキストファイル
15
+
16
+ 翻訳文字列に保存されたデータベースの再利用されます。
17
+
18
+ ## 設置
19
+
20
+ この機能を追加ラインの中から必要なものを選んで使用 `Gemfile`:
21
+
22
+ `ruby
23
+ gem 'translatomatic'
24
+ `
25
+
26
+ そして実行す:
27
+
28
+ $ bundle
29
+
30
+ インストールで自分自身:
31
+
32
+ $ gem install translatomatic
33
+
34
+ ## 用途
35
+
36
+ のコマンドラインインターフェース翻訳のための機能を `translatomatic`ます。 めに利用可能なオプションは、実行す:
37
+
38
+ $ translatomatic help
39
+
40
+ ### 翻訳ファイル
41
+
42
+ `translatomatic` 変換テキストの文章や言葉です。 場合はファイルを再翻訳の文言変更への翻訳に対しても、それぞれの地域からデータベースです。
43
+
44
+ るシリコーンコーティング翻訳サービス-オプション:
45
+
46
+ $ translatomatic translators
47
+
48
+ するJavaプロパティファイルをドイツ語、フランス語:
49
+
50
+ $ translatomatic translate resources/strings.properties de fr
51
+
52
+ こうした成(上書き) `strings_de.properties` - `strings_fr.properties`ます。
53
+
54
+ ### 抽出から文字列をソースファイル
55
+
56
+ 抽出から文字列の一部のソースファイルを抽出すコマンドなどの
57
+
58
+ $ translatomatic strings file.rb
59
+
60
+ ### 表示文字列からリソースバンドル
61
+
62
+ 読みを表示 `store.description` - `store.name` 物件からの現地リソースファイル、英語、ドイツ、フランス語:
63
+
64
+ $ translatomatic display --locales=en,de,fr \
65
+ resources/strings.properties store.description store.name
66
+
67
+ ## 構成
68
+
69
+ デフォルトでは、 `translatomatic` を使用してsqlite3データベース `$HOME/.translatomatic/translatomatic.sqlite3` 店舗の翻訳の文字列です。 データベースの変更により作成 `database.yml` ファイル `$HOME/.translatomatic/database.yml` のための `production` 環境、例えば
70
+
71
+ production:
72
+ adapter: mysql2
73
+ host: db.example.com
74
+ database: translatomatic
75
+ pool: 5
76
+ encoding: utf8
77
+ username: username
78
+ password: password
79
+
80
+ ## の貢献
81
+
82
+ バグ報告を引き要請を歓迎GitHubでhttps://github.com/smugglys/translatomaticます。 このプロジェクトなどに対応できるようになっても安全で快適なスペースのための協力者が付着し [執筆規約](http://contributor-covenant.org) 行動規範です。
83
+
84
+ ## ライセンス
85
+
86
+ の逸品をご用意してオープンソースの条件の下での [MITライセンス](https://opensource.org/licenses/MIT)ます。
87
+
88
+ ## 行動規範
89
+
90
+ 皆様との交流のTranslatomaticプロジェクトのcodebases、ラッカー、チャットルームやメーリングリストで入力してください [行動規範](https://github.com/smugglys/translatomatic/blob/master/CODE_OF_CONDUCT.md)ます。
91
+
92
+ _Created by Translatomatic 0.1.0 2017-12-29 00:38_
data/README.md CHANGED
@@ -1,74 +1,96 @@
1
- [![Build Status](https://travis-ci.org/smugglys/translatomatic.svg?branch=master)](https://travis-ci.org/smugglys/translatomatic)
2
- [![Gem Version](https://badge.fury.io/rb/translatomatic.svg)](https://badge.fury.io/rb/translatomatic)
3
- [![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/translatomatic)
4
-
5
- # Translatomatic
6
-
7
- Translates text files from one language to another.
8
-
9
- Features:
10
- - Translated strings are saved in a database and reused.
11
- - Understands how to translate different types of files, e.g. java properties, xcode strings, YAML, text, markdown.
12
-
13
- ## Installation
14
-
15
- Add this line to your application's Gemfile:
16
-
17
- ```ruby
18
- gem 'translatomatic'
19
- ```
20
-
21
- And then execute:
22
-
23
- $ bundle
24
-
25
- Or install it yourself as:
26
-
27
- $ gem install translatomatic
28
-
29
- ## Usage
30
-
31
- The command line interface for translation functionality is **translatomatic**. For help on available options, execute:
32
-
33
- $ translatomatic help
34
-
35
- ## Example Usage
36
-
37
- To list available translation backends and options:
38
-
39
- $ translatomatic translators
40
-
41
- To translate a java properties file to German and French:
42
-
43
- $ translatomatic src/main/resources/strings.properties de fr
44
-
45
- This would create the following files.
46
-
47
- src/main/resources/strings_de.properties
48
- src/main/resources/strings_fr.properties
49
-
50
- ## Configuration
51
-
52
- By default, translatomatic uses an sqlite3 database in *$HOME/.translatomatic/translatomatic.sqlite3* to store translated strings.
53
- The database can be changed by creating a *database.yml* file under *$HOME/.translatomatic/database.yml* for the **production** environment, e.g.
54
-
55
- production:
56
- adapter: mysql2
57
- host: db.example.com
58
- database: translatomatic
59
- pool: 5
60
- encoding: utf8
61
- username: username
62
- password: password
63
-
64
- ## Contributing
65
-
66
- 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.
67
-
68
- ## License
69
-
70
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
71
-
72
- ## Code of Conduct
73
-
74
- Everyone interacting in 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).
1
+ [![Documentation](http://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/translatomatic)
2
+ [![Gem Version](https://badge.fury.io/rb/translatomatic.svg)](https://badge.fury.io/rb/translatomatic)
3
+ [![Build Status](https://travis-ci.org/smugglys/translatomatic.svg?branch=master)](https://travis-ci.org/smugglys/translatomatic)
4
+ [![Code Climate](https://codeclimate.com/github/smugglys/translatomatic.svg)](https://codeclimate.com/github/smugglys/translatomatic)
5
+
6
+ # Translatomatic
7
+
8
+ Translates text files from one language to another. The following file formats
9
+ are currently supported:
10
+
11
+ * [Properties](https://en.wikipedia.org/wiki/.properties)
12
+ * RESW (Windows resources file)
13
+ * [Property lists](https://en.wikipedia.org/wiki/Property_list) (OSX plist)
14
+ * HTML
15
+ * XML
16
+ * [XCode strings](https://developer.apple.com/library/content/documentation/Cocoa/Conceptual/LoadingResources/Strings/Strings.html)
17
+ * [YAML](http://yaml.org/)
18
+ * Text files
19
+
20
+ Translated strings are saved in a database and reused.
21
+
22
+ ## Installation
23
+
24
+ Add this line to your application's `Gemfile`:
25
+
26
+ ```ruby
27
+ gem 'translatomatic'
28
+ ```
29
+
30
+ And then execute:
31
+
32
+ $ bundle
33
+
34
+ Or install it yourself as:
35
+
36
+ $ gem install translatomatic
37
+
38
+ ## Usage
39
+
40
+ The command line interface for translation functionality is `translatomatic`. For help on available options, execute:
41
+
42
+ $ translatomatic help
43
+
44
+ ### Translating files
45
+
46
+ `translatomatic` translates text one sentence or phrase at a time.
47
+ If a file is re-translated, only sentences that have changed are sent to the translator, and the rest are sourced from the local database.
48
+
49
+ To list available translation services and options:
50
+
51
+ $ translatomatic translators
52
+
53
+ To translate a Java properties file to German and French:
54
+
55
+ $ translatomatic translate resources/strings.properties de fr
56
+
57
+ This would create (or overwrite) `strings_de.properties` and `strings_fr.properties`.
58
+
59
+ ### Extracting strings from source files
60
+
61
+ To extract strings from some source files, use the extract command, e.g.
62
+
63
+ $ translatomatic strings file.rb
64
+
65
+ ### Displaying strings from a resource bundle
66
+
67
+ To read and display the `store.description` and `store.name` properties from local resource files in English, German, and French:
68
+
69
+ $ translatomatic display --locales=en,de,fr \
70
+ resources/strings.properties store.description store.name
71
+
72
+ ## Configuration
73
+
74
+ By default, `translatomatic` uses an sqlite3 database in `$HOME/.translatomatic/translatomatic.sqlite3` to store translated strings.
75
+ The database can be changed by creating a `database.yml` file under `$HOME/.translatomatic/database.yml` for the `production` environment, e.g.
76
+
77
+ production:
78
+ adapter: mysql2
79
+ host: db.example.com
80
+ database: translatomatic
81
+ pool: 5
82
+ encoding: utf8
83
+ username: username
84
+ password: password
85
+
86
+ ## Contributing
87
+
88
+ 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.
89
+
90
+ ## License
91
+
92
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
93
+
94
+ ## Code of Conduct
95
+
96
+ 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).
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
data/bin/setup CHANGED
@@ -1,8 +1,8 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/bin/translatomatic CHANGED
@@ -1,6 +1,6 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "translatomatic"
5
-
6
- Translatomatic::CLI.start
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "translatomatic"
5
+
6
+ Translatomatic::CLI.start
data/bin/travis ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env bash
2
+
3
+ [ "$TRAVIS_OS_NAME" == "linux" ] || exit 0
4
+
5
+ REPORTER_PATH=tmp/cache/codeclimate
6
+ REPORTER_CMD=$REPORTER_PATH/cc-test-reporter
7
+ REPORTER_URL=https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
8
+ mkdir -p $REPORTER_PATH
9
+
10
+ function remote_size {
11
+ curl -sIL "$1" | awk '/Content-Length/ {sub("\r",""); print $2}' | tail -1
12
+ }
13
+
14
+ if [ "$1" == "before" ]; then
15
+ gem install sqlite3 # enable database tests
16
+
17
+ local_size=$(wc -c < $REPORTER_CMD 2>/dev/null)
18
+ remote_size=$(remote_size $REPORTER_URL)
19
+ if [ "$local_size" != "$remote_size" ]; then
20
+ curl -L $REPORTER_URL -o $REPORTER_CMD
21
+ chmod +x $REPORTER_CMD
22
+ fi
23
+ $REPORTER_CMD before-build
24
+ elif [ "$1" == "after" ]; then
25
+ $REPORTER_CMD after-build --exit-code $TRAVIS_TEST_RESULT
26
+ fi
data/db/database.yml CHANGED
@@ -1,9 +1,9 @@
1
- production:
2
- adapter: sqlite3
3
- encoding: utf-8
4
- database: $HOME/.translatomatic/translatomatic.sqlite3
5
-
6
- test:
7
- adapter: sqlite3
8
- encoding: utf-8
9
- database: $GEM_ROOT/spec/tmp/translatomatic.sqlite3
1
+ production:
2
+ adapter: sqlite3
3
+ encoding: utf-8
4
+ database: $HOME/.translatomatic/translatomatic.sqlite3
5
+
6
+ test:
7
+ adapter: sqlite3
8
+ encoding: utf-8
9
+ database: $GEM_ROOT/spec/tmp/translatomatic.sqlite3
@@ -1,23 +1,24 @@
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]
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.string :translator
20
- t.timestamps
21
- end
22
- end
23
- 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]
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
+ end
24
+ end