lost_in_translation 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +68 -0
- data/Rakefile +8 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/lost_in_translation.rb +16 -0
- data/lib/lost_in_translation/cleanup.rb +32 -0
- data/lib/lost_in_translation/difference.rb +38 -0
- data/lib/lost_in_translation/hash.rb +43 -0
- data/lib/lost_in_translation/interactive.rb +37 -0
- data/lib/lost_in_translation/railtie.rb +11 -0
- data/lib/lost_in_translation/recent.rb +35 -0
- data/lib/lost_in_translation/user_interface.rb +54 -0
- data/lib/lost_in_translation/version.rb +3 -0
- data/lib/tasks/translate.rake +39 -0
- data/lost_in_translation.gemspec +25 -0
- metadata +107 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 61a6d51289069850654eb0f58df42f8eb798c1cf
|
4
|
+
data.tar.gz: 62d548671c8d3aeb56f1b487758334247a3a506a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 737e460adc20e52a72d82f7aad81ab60ada0cc1780a11d4a323619e7994ba7166615511f32847117d4ea44146444923afe762374343141adbf13de1a1b05a8ab
|
7
|
+
data.tar.gz: 1bc41c6f2a72f905351686aeb8e9942fe640122a28f1a51633033387a5ab0f9dd8979c376d2bfbadc328d45c4592ddcc784e024a85aa05ae6250adb945e5b4aa
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at yves.goizet@hotmail.de. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Datyv
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
# LostInTranslation
|
2
|
+
|
3
|
+
This gem provides you three tasks to translate your yaml!
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'lost_in_translation'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install lost_in_translation
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
There are three tasks you can execute.
|
23
|
+
|
24
|
+
### ATTENTION: Use at your own risk! Back you shit up, before using this!
|
25
|
+
Each will ask you for the file
|
26
|
+
If this gem is installed inside a Rails-Application you just have to written
|
27
|
+
e.g.:
|
28
|
+
```
|
29
|
+
'en' -> for en.yml
|
30
|
+
'de' -> for de.yml
|
31
|
+
...
|
32
|
+
```
|
33
|
+
One will be the master-file (this one will not be changed)
|
34
|
+
and
|
35
|
+
One will be the slave-file (this one will be changed)
|
36
|
+
|
37
|
+
#### Script 1: Interactive
|
38
|
+
```bash
|
39
|
+
rake translate:interactive
|
40
|
+
```
|
41
|
+
This script will ask you for the missing value.
|
42
|
+
It will find every difference and will ask you to fill every hole... yeah.
|
43
|
+
After everything is filled out it will merge the data back into your File.
|
44
|
+
|
45
|
+
#### Script 2: Recent
|
46
|
+
```bash
|
47
|
+
rake translate:recent
|
48
|
+
```
|
49
|
+
REQUIRED: Connection to Git
|
50
|
+
This script will ask you for the missing value.
|
51
|
+
It will find everything you changed in your master-file since you last pushed commit.
|
52
|
+
After everything is filled out it will merge the data back into your File.
|
53
|
+
|
54
|
+
#### Script 3: Cleanup (Deletes something!)
|
55
|
+
```bash
|
56
|
+
rake translate:cleanup
|
57
|
+
```
|
58
|
+
This script will find every key/value inside your slave-file that isn´t present in your master-file.
|
59
|
+
And it will be deleted!!!!
|
60
|
+
|
61
|
+
## Contributing
|
62
|
+
|
63
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/datyv/lost_in_translation. 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.
|
64
|
+
|
65
|
+
|
66
|
+
## License
|
67
|
+
|
68
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "lost_in_translation"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require "lost_in_translation/version"
|
2
|
+
require "lost_in_translation/difference"
|
3
|
+
require "lost_in_translation/hash"
|
4
|
+
require "lost_in_translation/user_interface"
|
5
|
+
require "lost_in_translation/recent"
|
6
|
+
require "lost_in_translation/interactive"
|
7
|
+
require "lost_in_translation/cleanup"
|
8
|
+
require 'lost_in_translation/railtie' if defined?(Rails)
|
9
|
+
|
10
|
+
module LostInTranslation
|
11
|
+
|
12
|
+
end
|
13
|
+
|
14
|
+
class Translate
|
15
|
+
extend LostInTranslation
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module LostInTranslation
|
2
|
+
def cleanup
|
3
|
+
if defined? Rails
|
4
|
+
app_name = Rails.application.class.parent_name
|
5
|
+
lang_2, lang_1 = Translate.ask_for_languages
|
6
|
+
path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
|
7
|
+
path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
|
8
|
+
else
|
9
|
+
app_name = nil
|
10
|
+
path_2, path_1 = Translate.ask_for_paths
|
11
|
+
|
12
|
+
lang_1 = Translate.get_locale(path_1)
|
13
|
+
lang_2 = Translate.get_locale(path_2)
|
14
|
+
end
|
15
|
+
|
16
|
+
abort('NOPE') unless File.exist?(path_1) && File.exist?(path_2)
|
17
|
+
|
18
|
+
first = YAML.load_file(path_1)
|
19
|
+
second = YAML.load_file(path_2)
|
20
|
+
|
21
|
+
new_strings_array = Translate.clean(first[lang_1], second[lang_2], [lang_2])
|
22
|
+
|
23
|
+
first = {}
|
24
|
+
new_strings_array.each do |string|
|
25
|
+
string = string.split('---').map { |x| x == lang_2 ? x = lang_1 : x }.join('---')
|
26
|
+
result = Translate.string_to_hash(string)
|
27
|
+
Translate.merge_hash(result, first)
|
28
|
+
end
|
29
|
+
|
30
|
+
File.open(path_1, 'w') { |file| file.write(first.to_yaml) }
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module LostInTranslation
|
2
|
+
def diff(root, compared, lang_1, lang_2, structure = [], max_count = 0, new_array = [])
|
3
|
+
count = 0
|
4
|
+
root.each_pair do |key,value|
|
5
|
+
next_root = root[key]
|
6
|
+
next_compared = compared.nil? ? nil : compared[key]
|
7
|
+
new_structure = structure.dup << key
|
8
|
+
if value.is_a? String
|
9
|
+
if compared.nil? || compared[key].nil?
|
10
|
+
new_val = ask_for_translation(value, new_structure, lang_1, lang_2)
|
11
|
+
new_array << new_val unless new_val.nil?
|
12
|
+
count += 1
|
13
|
+
end
|
14
|
+
end
|
15
|
+
diff(next_root, next_compared, lang_1, lang_2, new_structure, new_array) if next_root.kind_of? Hash
|
16
|
+
end
|
17
|
+
new_array
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_locale(path)
|
21
|
+
path.split('/').last.split('.').first unless path.empty?
|
22
|
+
end
|
23
|
+
|
24
|
+
def clean(root, compared, structure = [], new_array = [])
|
25
|
+
root.each_pair do |key,value|
|
26
|
+
next_root = root[key]
|
27
|
+
next_compared = compared.nil? ? nil : compared[key]
|
28
|
+
new_structure = structure.dup << key
|
29
|
+
if value.is_a? String
|
30
|
+
unless compared.nil? || compared[key].nil?
|
31
|
+
new_array << "#{new_structure.join('---')}-#{value}"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
clean(next_root, next_compared, new_structure, new_array) if next_root.kind_of? Hash
|
35
|
+
end
|
36
|
+
new_array
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module LostInTranslation
|
2
|
+
def string_to_hash(string)
|
3
|
+
array = string.split('-')
|
4
|
+
value = array.pop
|
5
|
+
h = Hash.new
|
6
|
+
anz = array.count - 1
|
7
|
+
puts array.count if array.count > 6
|
8
|
+
(0..anz).each do |key|
|
9
|
+
h[array[0]] = (anz == key ? value : Hash.new) if key == 0
|
10
|
+
h[array[0]][array[1]] = (anz == key ? value : Hash.new) if key == 1
|
11
|
+
h[array[0]][array[1]][array[2]] = (anz == key ? value : Hash.new) if key == 2
|
12
|
+
h[array[0]][array[1]][array[2]][array[3]] = (anz == key ? value : Hash.new) if key == 3
|
13
|
+
h[array[0]][array[1]][array[2]][array[3]][array[4]] = (anz == key ? value : Hash.new) if key == 4
|
14
|
+
h[array[0]][array[1]][array[2]][array[3]][array[4]][array[5]] = (anz == key ? value : Hash.new) if key == 5
|
15
|
+
h[array[0]][array[1]][array[2]][array[3]][array[4]][array[5]][array[6]] = (anz == key ? value : Hash.new) if key == 6
|
16
|
+
h[array[0]][array[1]][array[2]][array[3]][array[4]][array[5]][array[6]][array[7]] = (anz == key ? value : Hash.new) if key == 7
|
17
|
+
### TO BE IMPROVED ! This is shit and I know it.
|
18
|
+
end
|
19
|
+
h
|
20
|
+
end
|
21
|
+
|
22
|
+
def merge_hash(merge_from, merge_to)
|
23
|
+
unless merge_from.kind_of?(String) || merge_to.kind_of?(String)
|
24
|
+
merged_hash = merge_to
|
25
|
+
first_key = merge_from.keys.first
|
26
|
+
if merge_to.has_key?(first_key)
|
27
|
+
merged_hash[first_key] = merge_hash( merge_from[first_key], merge_to[first_key] )
|
28
|
+
else
|
29
|
+
merged_hash[first_key] = merge_from[first_key]
|
30
|
+
end
|
31
|
+
merged_hash
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
def sort_hash(object)
|
37
|
+
return object unless object.is_a?(Hash)
|
38
|
+
hash = Hash.new
|
39
|
+
object.each { |k, v| hash[k] = sort_hash(v) }
|
40
|
+
sorted = hash.sort { |a, b| a[0].to_s <=> b[0].to_s }
|
41
|
+
hash.class[sorted]
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
module LostInTranslation
|
2
|
+
def interactive
|
3
|
+
if defined? Rails
|
4
|
+
app_name = Rails.application.class.parent_name
|
5
|
+
lang_1, lang_2 = Translate.ask_for_languages
|
6
|
+
path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
|
7
|
+
path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
|
8
|
+
else
|
9
|
+
app_name = nil
|
10
|
+
path_1, path_2 = Translate.ask_for_paths
|
11
|
+
|
12
|
+
lang_1 = Translate.get_locale(path_1)
|
13
|
+
lang_2 = Translate.get_locale(path_2)
|
14
|
+
end
|
15
|
+
|
16
|
+
abort('NOPE') unless File.exist?(path_1) && File.exist?(path_2)
|
17
|
+
abort('Well, in that case, forget it!') unless Translate.ask_for_permission(lang_1,lang_2,app_name)
|
18
|
+
|
19
|
+
first = YAML.load_file(path_1)
|
20
|
+
second = YAML.load_file(path_2)
|
21
|
+
|
22
|
+
new_strings_array = Translate.diff(first[lang_1], second[lang_2], lang_1, lang_2, [lang_2])
|
23
|
+
|
24
|
+
new_strings_array.each do |string|
|
25
|
+
result = Translate.string_to_hash(string)
|
26
|
+
Translate.merge_hash(result, second)
|
27
|
+
end
|
28
|
+
|
29
|
+
if Translate.ask_for_sorting(lang_1, app_name)
|
30
|
+
first = Translate.sort_hash(first)
|
31
|
+
File.open(path_1, 'w') { |file| file.write(first.to_yaml) }
|
32
|
+
end
|
33
|
+
|
34
|
+
second = Translate.sort_hash(second) if Translate.ask_for_sorting(lang_2, app_name)
|
35
|
+
File.open(path_2, 'w') { |file| file.write(second.to_yaml) }
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module LostInTranslation
|
2
|
+
def recent
|
3
|
+
app_name = Rails.application.class.parent_name
|
4
|
+
lang_1, lang_2 = Translate.ask_for_languages
|
5
|
+
path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
|
6
|
+
copy_path_1 = "#{Rails.root}/config/locales/#{lang_1}_copy.yml"
|
7
|
+
path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
|
8
|
+
|
9
|
+
abort('NOPE') unless File.exist?(path_1) && File.exist?(path_2)
|
10
|
+
|
11
|
+
FileUtils.cp(path_1, copy_path_1)
|
12
|
+
`git checkout "#{path_1}"`
|
13
|
+
|
14
|
+
first = YAML.load_file(path_1)
|
15
|
+
first_copy = YAML.load_file(copy_path_1)
|
16
|
+
second = YAML.load_file(path_2)
|
17
|
+
new_strings_array = Translate.diff(first_copy[lang_1], first[lang_1], lang_1, lang_2, [lang_1])
|
18
|
+
|
19
|
+
new_strings_array.each do |string|
|
20
|
+
string = string.split('---').map { |x| x == lang_1 ? x = lang_2 : x }.join('---')
|
21
|
+
result = Translate.string_to_hash(string)
|
22
|
+
Translate.merge_hash(result, second)
|
23
|
+
end
|
24
|
+
|
25
|
+
if Translate.ask_for_sorting(lang_1, app_name)
|
26
|
+
first_copy = Translate.sort_hash(first_copy)
|
27
|
+
File.open(path_1, 'w') { |file| file.write(first_copy.to_yaml) }
|
28
|
+
end
|
29
|
+
|
30
|
+
second = Translate.sort_hash(second) if Translate.ask_for_sorting(lang_2, app_name)
|
31
|
+
File.open(path_2, 'w') { |file| file.write(second.to_yaml) }
|
32
|
+
|
33
|
+
FileUtils.rm(copy_path_1)
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module LostInTranslation
|
2
|
+
def ask_for_permission(lang_1, lang_2, app_name)
|
3
|
+
system "clear"
|
4
|
+
puts "Comparing Locales"
|
5
|
+
puts "Application: #{app_name}" unless app_name.nil?
|
6
|
+
puts "Master Locale: #{lang_1}.yml"
|
7
|
+
puts "Slave Locale: #{lang_2}.yml"
|
8
|
+
puts "Is this ok?[y/n]"
|
9
|
+
a = STDIN.gets.chomp
|
10
|
+
a == 'y' || a == 'Y'
|
11
|
+
end
|
12
|
+
|
13
|
+
def ask_for_languages
|
14
|
+
system "clear"
|
15
|
+
puts "What I18n-yaml files do you want to compare?"
|
16
|
+
lang_1 = [(print "Master (e.g. 'en'): "), STDIN.gets.chomp][1]
|
17
|
+
lang_2 = [(print "Slave: (e.g. 'de'): "), STDIN.gets.chomp][1]
|
18
|
+
[lang_1, lang_2]
|
19
|
+
end
|
20
|
+
|
21
|
+
def ask_for_max_count
|
22
|
+
system "clear"
|
23
|
+
puts "How many do you want to edit max?"
|
24
|
+
max_count = [(print "Max. Count (default = 50000): "), STDIN.gets.chomp][1]
|
25
|
+
max_count
|
26
|
+
end
|
27
|
+
|
28
|
+
def ask_for_paths
|
29
|
+
system "clear"
|
30
|
+
puts "Please type in the absolute paths to the I18n-yaml file you want to compare?"
|
31
|
+
puts "e.g. /home/youruser/Documents/your-awesome-app/config/locales/en.yml"
|
32
|
+
path_1 = [(print "Master: "), STDIN.gets.chomp][1]
|
33
|
+
path_2 = [(print "Slave:: "), STDIN.gets.chomp][1]
|
34
|
+
[path_1,path_2]
|
35
|
+
end
|
36
|
+
|
37
|
+
def ask_for_sorting(lang, app_name)
|
38
|
+
system "clear"
|
39
|
+
puts "Do you want the #{lang}.yml to be sorted?"
|
40
|
+
puts "Alphabetically & Recursive (ASC)"
|
41
|
+
puts "[y/n]"
|
42
|
+
a = STDIN.gets.chomp
|
43
|
+
a == 'y' || a == 'Y'
|
44
|
+
end
|
45
|
+
|
46
|
+
def ask_for_translation(value, new_structure, lang_1, lang_2)
|
47
|
+
system "clear"
|
48
|
+
new_s = new_structure.join('---')
|
49
|
+
puts "#{new_s} is missing"
|
50
|
+
puts "in #{lang_1}: #{value}"
|
51
|
+
new_val = [(print lang_2 + ": "), STDIN.gets.chomp][1]
|
52
|
+
new_val == '' ? nil : (new_s + '---' + new_val)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'yaml'
|
2
|
+
require 'lost_in_translation'
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
namespace :translate do
|
6
|
+
desc "Make the locale-yamls equal again(Interactive)"
|
7
|
+
task :interactive do
|
8
|
+
Translate.interactive
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :translate do
|
13
|
+
desc "Use Bing-Translator as a suggestion for translation"
|
14
|
+
task :half_automatic do
|
15
|
+
return 'to_be_done'
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
namespace :translate do
|
20
|
+
desc "Use Bing-Translator to automatically translate everything"
|
21
|
+
task :full_automatic do
|
22
|
+
return 'to_be_done'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
namespace :translate do
|
27
|
+
desc "Cleaning out the Yaml-Closet)"
|
28
|
+
task :cleanup do
|
29
|
+
Translate.cleanup
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
namespace :translate do
|
34
|
+
desc "Tranlate just your recently changed words"
|
35
|
+
task :recent do
|
36
|
+
abort('Please use this feature inside a Rails-Application') unless defined? Rails
|
37
|
+
Translate.recent
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'lost_in_translation/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "lost_in_translation"
|
8
|
+
spec.version = LostInTranslation::VERSION
|
9
|
+
spec.authors = ["Datyv"]
|
10
|
+
spec.email = ["yves.goizet@hotmail.de"]
|
11
|
+
|
12
|
+
spec.summary = %q{A Gem to Campare different yaml-files}
|
13
|
+
spec.description = %q{Take two locales and merge them together with different values.}
|
14
|
+
spec.homepage = "https://github.com/Datyv/lost_in_translation"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
23
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: lost_in_translation
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Datyv
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.11'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.11'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: Take two locales and merge them together with different values.
|
56
|
+
email:
|
57
|
+
- yves.goizet@hotmail.de
|
58
|
+
executables: []
|
59
|
+
extensions: []
|
60
|
+
extra_rdoc_files: []
|
61
|
+
files:
|
62
|
+
- ".gitignore"
|
63
|
+
- ".rspec"
|
64
|
+
- ".travis.yml"
|
65
|
+
- CODE_OF_CONDUCT.md
|
66
|
+
- Gemfile
|
67
|
+
- LICENSE.txt
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- bin/console
|
71
|
+
- bin/setup
|
72
|
+
- lib/lost_in_translation.rb
|
73
|
+
- lib/lost_in_translation/cleanup.rb
|
74
|
+
- lib/lost_in_translation/difference.rb
|
75
|
+
- lib/lost_in_translation/hash.rb
|
76
|
+
- lib/lost_in_translation/interactive.rb
|
77
|
+
- lib/lost_in_translation/railtie.rb
|
78
|
+
- lib/lost_in_translation/recent.rb
|
79
|
+
- lib/lost_in_translation/user_interface.rb
|
80
|
+
- lib/lost_in_translation/version.rb
|
81
|
+
- lib/tasks/translate.rake
|
82
|
+
- lost_in_translation.gemspec
|
83
|
+
homepage: https://github.com/Datyv/lost_in_translation
|
84
|
+
licenses:
|
85
|
+
- MIT
|
86
|
+
metadata: {}
|
87
|
+
post_install_message:
|
88
|
+
rdoc_options: []
|
89
|
+
require_paths:
|
90
|
+
- lib
|
91
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
96
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
101
|
+
requirements: []
|
102
|
+
rubyforge_project:
|
103
|
+
rubygems_version: 2.5.1
|
104
|
+
signing_key:
|
105
|
+
specification_version: 4
|
106
|
+
summary: A Gem to Campare different yaml-files
|
107
|
+
test_files: []
|