locales_export_import 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: df3dca3ca00924093e0588723666f34cb5c79556
4
- data.tar.gz: 8e33aa195182a43849003b726e6a77b34c0aa59c
3
+ metadata.gz: dc17ccfb4731014d4540fcf55ebc2b80e546e5de
4
+ data.tar.gz: bfec6dc2a76f2d6f57d066b94a8c53ba7dae4103
5
5
  SHA512:
6
- metadata.gz: 4b8bd6defc356162b60bbdbece7008208347548378842a53457ce76f6d8304646d085c8917238d8b057c77558ce296dd402bba7ada45b5843437ad6158c36895
7
- data.tar.gz: 775b17d57ac4d128ea3b5c2e2b626e7e0dfc0f6457485402d2627a79973280456d0a2499f24aaff043a797aadbea67b298293c5dd17bdf1e8b2230accf75b3d6
6
+ metadata.gz: 7cf28a1cecdd3b12b48927104eaec1ad5a5de244074103e7173b1d0b1b6edd9d68ca4d9bac566891a5a3a7b211650b6f3ac91517974c13ec32700b0c7635fc8a
7
+ data.tar.gz: b409b2ce3c923df0ecf5b1154e1204c91fc8c479ff934a777464fbec293431766fc0ec30b5ca118a9fb2cba300914b0d459c0476329d4d9a3d1f2dace31d029b
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
- # LocalesExportImport
1
+ # Locales Export & Import
2
2
 
3
- TODO: Write a gem description
3
+ This gem is designed to work with Rails I18n locale files, but it's not dependent on Rails, so can be also used elsewhere. Translation agencies prefer working with the tools they know, typically Excel, while ruby developers usually store localized strings in yaml files. locale_export_import helps with easy conversion between the two formats to make developer-translator interaction less painful.
4
+
5
+ The typical workflow of adding new locale(s) with this gem is as follows:
6
+
7
+ 1. Developer exports his base locale file to CSV (currently only CSV is supported, XLSX support is planned).
8
+ 2. Translator opens the file in Excel, adds one or several columns with translated texts (one column per locale).
9
+ 3. Developer converts the resulting file to YAML file(s) and commits the changes.
4
10
 
5
11
  ## Installation
6
12
 
@@ -18,7 +24,52 @@ Or install it yourself as:
18
24
 
19
25
  ## Usage
20
26
 
21
- TODO: Write usage instructions here
27
+ #### Converting locale YAML file to CSV:
28
+ ```
29
+ LocalesExportImport::Yaml2Csv.convert(locale_file_names_array, output_file_name, pattern = nil)
30
+ ```
31
+
32
+ For example:
33
+ ```
34
+ LocalesExportImport::Yaml2Csv.convert(['config/locales/en.yml'], 'en_keys.csv')
35
+ ```
36
+ Resulting CSV is in the following format:
37
+ ```
38
+ key,en_value
39
+ en.views.login.remember_me,Remember me
40
+ ...
41
+ ```
42
+
43
+ For multiple locales at once:
44
+ ```
45
+ LocalesExportImport::Yaml2Csv.convert(
46
+ %w[config/locales/en-UK.yml config/locales/de-DE.yml],
47
+ 'en_de_keys.csv'
48
+ )
49
+ ```
50
+ And the result will be something like this:
51
+ ```
52
+ key,en-UK_value,de-DE_value
53
+ en.views.login.remember_me,Remember me,Mich eingeloggt lassen
54
+ en.views.login.log_in,Log in,Einloggen
55
+ ...
56
+ ```
57
+ Not that each column header for translation texts should be in the format #{locale}_value
58
+
59
+ Exporting only the texts that match a certain pattern:
60
+ ```
61
+ LocalesExportImport::Yaml2Csv.convert(['config/locales/en.yml'], 'en_login_keys.csv', /login/i)
62
+ ```
63
+
64
+ #### Converting CSV back to YAML:
65
+ ```
66
+ LocalesExportImport::Csv2Yaml.convert(csv_file_name)
67
+ ````
68
+
69
+ The result will be the locale file(s) in the current working directory, one file for each locale column found in the headers. E.g. if CSV file header row was "key,en-UK,de-DE,fi-FI", then the resulting files will be en-UK.yml, de-DE.yml, and fi-FI.yml populated with corresponding translated strings.
70
+
71
+ Note that if you already have one or several locale files in the same folder (e.g. en-UK.yml and de-DE.yml), these files will be loaded and updated with new values. That way you can import new portion of translations to already exsisting locale file, adding only the new ones while keeping the old keys/values inatact.
72
+
22
73
 
23
74
  ## Contributing
24
75
 
@@ -1,3 +1,3 @@
1
1
  module LocalesExportImport
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.email = ["pavlozahozhenko@gmail.com"]
11
11
  spec.description = %q{Used for exporting locale yaml files to CSV format. CSV files are then being imported into Excel, edited by translators, then imported back to yaml.}
12
12
  spec.summary = "Used for exporting and importing locale yaml files to CSV"
13
- spec.homepage = ""
13
+ spec.homepage = "https://github.com/buru/locales_export_import"
14
14
  spec.license = "MIT"
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locales_export_import
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - buru
@@ -72,7 +72,7 @@ files:
72
72
  - locales_export_import.gemspec
73
73
  - spec/locales_export_import/yaml2csv_spec.rb
74
74
  - spec/support/files/sample_locale.yml
75
- homepage: ''
75
+ homepage: https://github.com/buru/locales_export_import
76
76
  licenses:
77
77
  - MIT
78
78
  metadata: {}