lost_in_translation 0.2.1 → 0.2.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: cf6836b41a6cef14f6f3b0eb18dd959d9679cd84
4
- data.tar.gz: 568b3b0a478257fb6b6ee8155463771f8dcee55b
3
+ metadata.gz: 1b5ad5b54d21c5230363ffd5484b7ea677ab628e
4
+ data.tar.gz: ce901a81a874616cb4c3dd91f209592861afaf76
5
5
  SHA512:
6
- metadata.gz: b56b7926b71d727ba4f170d2146bb7a8b63035eb53df1f0900e8cb4e9e40386a7fb6a7b0360bf37d3f88d613e6818d8a00b29e33f8d1a76b4ce46f7ebf3ce6bc
7
- data.tar.gz: faed2e14fc2d1d6deabd08724a1249e5b5a4ad67a2883bbf96fdf55850391ec23c0b0a6483b14a187e79f1e8aebe9741a6e0c5332e951de3e24daf3aa4a07988
6
+ metadata.gz: db2cff3026ff8b913ec0149c92b735a17717f9ceb3868a1e15a7519d006ffff8ec277bd8d57adef022b989c29a6b3c8885f29385f2045a335e4d24b54f371683
7
+ data.tar.gz: 5a086bf90a4b44a4f928fb25ca9f4634e27010c237a1cf2aabdc1597fefb3450475f6f7695eac4b260ded0ed7678c521071c14f14dcd795762fdcb5307500673
data/README.md CHANGED
@@ -65,11 +65,11 @@ In this case you can use the Rails-Console and the Class -LostInTranslation-.
65
65
  rails c
66
66
  ```
67
67
  ```
68
- LostInTranslation.interactive
68
+ LostInTranslationMain.interactive
69
69
  or
70
- LostInTranslation.recent
70
+ LostInTranslationMain.recent
71
71
  or
72
- LostInTranslation.cleanup
72
+ LostInTranslationMain.cleanup
73
73
  ```
74
74
 
75
75
  #### Yet to come
@@ -14,6 +14,6 @@ module LostInTranslation
14
14
 
15
15
  end
16
16
 
17
- class LostInTranslation
17
+ class LostInTranslationMain
18
18
  extend LostInTranslation
19
19
  end
@@ -1,3 +1,3 @@
1
1
  module LostInTranslation
2
- VERSION = "0.2.1"
2
+ VERSION = '0.2.2'
3
3
  end
@@ -2,15 +2,15 @@ module LostInTranslation
2
2
  def cleanup
3
3
  if defined? Rails
4
4
  app_name = Rails.application.class.parent_name
5
- lang_2, lang_1 = LostInTranslation.ask_for_languages
5
+ lang_2, lang_1 = LostInTranslationMain.ask_for_languages
6
6
  path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
7
7
  path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
8
8
  else
9
9
  app_name = nil
10
- path_2, path_1 = LostInTranslation.ask_for_paths
10
+ path_2, path_1 = LostInTranslationMain.ask_for_paths
11
11
 
12
- lang_1 = LostInTranslation.get_locale(path_1)
13
- lang_2 = LostInTranslation.get_locale(path_2)
12
+ lang_1 = LostInTranslationMain.get_locale(path_1)
13
+ lang_2 = LostInTranslationMain.get_locale(path_2)
14
14
  end
15
15
 
16
16
  abort('NOPE') unless File.exist?(path_1) && File.exist?(path_2)
@@ -20,13 +20,13 @@ module LostInTranslation
20
20
  first = YAML.load_file(path_1)
21
21
  second = YAML.load_file(path_2)
22
22
 
23
- new_strings_array = LostInTranslation.clean(first[lang_1], second[lang_2], [lang_2])
23
+ new_strings_array = LostInTranslationMain.clean(first[lang_1], second[lang_2], [lang_2])
24
24
 
25
25
  first = {}
26
26
  new_strings_array.each do |string|
27
27
  string = string.split('---').map { |x| x == lang_2 ? x = lang_1 : x }.join('---')
28
- result = LostInTranslation.string_to_hash(string)
29
- LostInTranslation.merge_hash(result, first)
28
+ result = LostInTranslationMain.string_to_hash(string)
29
+ LostInTranslationMain.merge_hash(result, first)
30
30
  end
31
31
 
32
32
  File.open(path_1, 'w') { |file| file.write(first.to_yaml) }
@@ -2,15 +2,15 @@ module LostInTranslation
2
2
  def full_automatic
3
3
  if defined? Rails
4
4
  app_name = Rails.application.class.parent_name
5
- lang_2, lang_1 = LostInTranslation.ask_for_languages
5
+ lang_2, lang_1 = LostInTranslationMain.ask_for_languages
6
6
  path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
7
7
  path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
8
8
  else
9
9
  app_name = nil
10
- path_2, path_1 = LostInTranslation.ask_for_paths
10
+ path_2, path_1 = LostInTranslationMain.ask_for_paths
11
11
 
12
- lang_1 = LostInTranslation.get_locale(path_1)
13
- lang_2 = LostInTranslation.get_locale(path_2)
12
+ lang_1 = LostInTranslationMain.get_locale(path_1)
13
+ lang_2 = LostInTranslationMain.get_locale(path_2)
14
14
  end
15
15
 
16
16
  abort('NOPE') unless File.exist?(path_1) && File.exist?(path_2)
@@ -18,13 +18,13 @@ module LostInTranslation
18
18
  first = YAML.load_file(path_1)
19
19
  second = YAML.load_file(path_2)
20
20
 
21
- new_strings_array = LostInTranslation.clean(first[lang_1], second[lang_2], [lang_2])
21
+ new_strings_array = LostInTranslationMain.clean(first[lang_1], second[lang_2], [lang_2])
22
22
 
23
23
  first = {}
24
24
  new_strings_array.each do |string|
25
25
  string = string.split('---').map { |x| x == lang_2 ? x = lang_1 : x }.join('---')
26
- result = LostInTranslation.string_to_hash(string)
27
- LostInTranslation.merge_hash(result, first)
26
+ result = LostInTranslationMain.string_to_hash(string)
27
+ LostInTranslationMain.merge_hash(result, first)
28
28
  end
29
29
 
30
30
  File.open(path_1, 'w') { |file| file.write(first.to_yaml) }
@@ -2,15 +2,15 @@ module LostInTranslation
2
2
  def half_automatic
3
3
  if defined? Rails
4
4
  app_name = Rails.application.class.parent_name
5
- lang_2, lang_1 = LostInTranslation.ask_for_languages
5
+ lang_2, lang_1 = LostInTranslationMain.ask_for_languages
6
6
  path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
7
7
  path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
8
8
  else
9
9
  app_name = nil
10
- path_2, path_1 = LostInTranslation.ask_for_paths
10
+ path_2, path_1 = LostInTranslationMain.ask_for_paths
11
11
 
12
- lang_1 = LostInTranslation.get_locale(path_1)
13
- lang_2 = LostInTranslation.get_locale(path_2)
12
+ lang_1 = LostInTranslationMain.get_locale(path_1)
13
+ lang_2 = LostInTranslationMain.get_locale(path_2)
14
14
  end
15
15
 
16
16
  abort('NOPE') unless File.exist?(path_1) && File.exist?(path_2)
@@ -18,13 +18,13 @@ module LostInTranslation
18
18
  first = YAML.load_file(path_1)
19
19
  second = YAML.load_file(path_2)
20
20
 
21
- new_strings_array = LostInTranslation.clean(first[lang_1], second[lang_2], [lang_2])
21
+ new_strings_array = LostInTranslationMain.clean(first[lang_1], second[lang_2], [lang_2])
22
22
 
23
23
  first = {}
24
24
  new_strings_array.each do |string|
25
25
  string = string.split('---').map { |x| x == lang_2 ? x = lang_1 : x }.join('---')
26
- result = LostInTranslation.string_to_hash(string)
27
- LostInTranslation.merge_hash(result, first)
26
+ result = LostInTranslationMain.string_to_hash(string)
27
+ LostInTranslationMain.merge_hash(result, first)
28
28
  end
29
29
 
30
30
  File.open(path_1, 'w') { |file| file.write(first.to_yaml) }
@@ -2,19 +2,19 @@ module LostInTranslation
2
2
  def interactive
3
3
  if defined? Rails
4
4
  app_name = Rails.application.class.parent_name
5
- lang_1, lang_2 = LostInTranslation.ask_for_languages
5
+ lang_1, lang_2 = LostInTranslationMain.ask_for_languages
6
6
  path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
7
7
  path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
8
8
  else
9
9
  app_name = nil
10
- path_1, path_2 = LostInTranslation.ask_for_paths
10
+ path_1, path_2 = LostInTranslationMain.ask_for_paths
11
11
 
12
- lang_1 = LostInTranslation.get_locale(path_1)
13
- lang_2 = LostInTranslation.get_locale(path_2)
12
+ lang_1 = LostInTranslationMain.get_locale(path_1)
13
+ lang_2 = LostInTranslationMain.get_locale(path_2)
14
14
  end
15
15
 
16
16
  abort('NOPE') unless File.exist?(path_1) && File.exist?(path_2)
17
- abort('Well, in that case, forget it!') unless LostInTranslation.ask_for_permission(lang_1,lang_2,app_name)
17
+ abort('Well, in that case, forget it!') unless LostInTranslationMain.ask_for_permission(lang_1,lang_2,app_name)
18
18
 
19
19
  prepare_paths(path_1, path_2, true)
20
20
  prepare_paths(path_1, path_2, false)
@@ -22,19 +22,19 @@ module LostInTranslation
22
22
  first = YAML.load_file(path_1)
23
23
  second = YAML.load_file(path_2)
24
24
 
25
- new_strings_array = LostInTranslation.diff(first[lang_1], second[lang_2], lang_1, lang_2, [lang_2])
25
+ new_strings_array = LostInTranslationMain.diff(first[lang_1], second[lang_2], lang_1, lang_2, [lang_2])
26
26
 
27
27
  new_strings_array.each do |string|
28
- result = LostInTranslation.string_to_hash(string)
29
- LostInTranslation.merge_hash(result, second)
28
+ result = LostInTranslationMain.string_to_hash(string)
29
+ LostInTranslationMain.merge_hash(result, second)
30
30
  end
31
31
 
32
- if LostInTranslation.ask_for_sorting(lang_1, app_name)
33
- first = LostInTranslation.sort_hash(first)
32
+ if LostInTranslationMain.ask_for_sorting(lang_1, app_name)
33
+ first = LostInTranslationMain.sort_hash(first)
34
34
  File.open(path_1, 'w') { |file| file.write(first.to_yaml(line_width: -1)) }
35
35
  end
36
36
 
37
- second = LostInTranslation.sort_hash(second) if LostInTranslation.ask_for_sorting(lang_2, app_name)
37
+ second = LostInTranslationMain.sort_hash(second) if LostInTranslationMain.ask_for_sorting(lang_2, app_name)
38
38
  File.open(path_2, 'w') { |file| file.write(second.to_yaml(line_width: -1)) }
39
39
 
40
40
  prepare_paths(path_1, path_2, true)
@@ -1,7 +1,7 @@
1
1
  module LostInTranslation
2
2
  def recent
3
3
  app_name = Rails.application.class.parent_name
4
- lang_1, lang_2 = LostInTranslation.ask_for_languages
4
+ lang_1, lang_2 = LostInTranslationMain.ask_for_languages
5
5
  path_1 = "#{Rails.root}/config/locales/#{lang_1}.yml"
6
6
  copy_path_1 = "#{Rails.root}/config/locales/#{lang_1}_copy.yml"
7
7
  path_2 = "#{Rails.root}/config/locales/#{lang_2}.yml"
@@ -16,20 +16,20 @@ module LostInTranslation
16
16
  first = YAML.load_file(path_1)
17
17
  first_copy = YAML.load_file(copy_path_1)
18
18
  second = YAML.load_file(path_2)
19
- new_strings_array = LostInTranslation.diff(first_copy[lang_1], first[lang_1], lang_1, lang_2, [lang_1])
19
+ new_strings_array = LostInTranslationMain.diff(first_copy[lang_1], first[lang_1], lang_1, lang_2, [lang_1])
20
20
 
21
21
  new_strings_array.each do |string|
22
22
  string = string.split('---').map { |x| x == lang_1 ? x = lang_2 : x }.join('---')
23
- result = LostInTranslation.string_to_hash(string)
24
- LostInTranslation.merge_hash(result, second)
23
+ result = LostInTranslationMain.string_to_hash(string)
24
+ LostInTranslationMain.merge_hash(result, second)
25
25
  end
26
26
 
27
- if LostInTranslation.ask_for_sorting(lang_1, app_name)
28
- first_copy = LostInTranslation.sort_hash(first_copy)
27
+ if LostInTranslationMain.ask_for_sorting(lang_1, app_name)
28
+ first_copy = LostInTranslationMain.sort_hash(first_copy)
29
29
  File.open(path_1, 'w') { |file| file.write(first_copy.to_yaml) }
30
30
  end
31
31
 
32
- second = LostInTranslation.sort_hash(second) if LostInTranslation.ask_for_sorting(lang_2, app_name)
32
+ second = LostInTranslationMain.sort_hash(second) if LostInTranslationMain.ask_for_sorting(lang_2, app_name)
33
33
  File.open(path_2, 'w') { |file| file.write(second.to_yaml) }
34
34
  prepare_paths(path_1, path_2, true)
35
35
 
data/lib/tasks/lit.rake CHANGED
@@ -5,7 +5,7 @@ require 'fileutils'
5
5
  namespace :lit do
6
6
  desc "Make the locale-yamls equal again(Interactive)"
7
7
  task :interactive do
8
- LostInTranslation.interactive
8
+ LostInTranslationMain.interactive
9
9
  end
10
10
  end
11
11
 
@@ -13,7 +13,7 @@ namespace :lit do
13
13
  desc "Use Bing-Translator as a suggestion for translation"
14
14
  task :half_automatic do
15
15
  return 'to_be_done'
16
- LostInTranslation.half_automatic
16
+ LostInTranslationMain.half_automatic
17
17
  end
18
18
  end
19
19
 
@@ -21,14 +21,14 @@ namespace :lit do
21
21
  desc "Use Bing-Translator to automatically translate everything"
22
22
  task :fully_automatic do
23
23
  return 'to_be_done'
24
- LostInTranslation.full_automatic
24
+ LostInTranslationMain.full_automatic
25
25
  end
26
26
  end
27
27
 
28
28
  namespace :lit do
29
29
  desc "Cleaning out the Yaml-Closet"
30
30
  task :cleanup do
31
- LostInTranslation.cleanup
31
+ LostInTranslationMain.cleanup
32
32
  end
33
33
  end
34
34
 
@@ -36,6 +36,6 @@ namespace :lit do
36
36
  desc "Tranlate just your recently changed Strings(requires git)"
37
37
  task :recent do
38
38
  abort('Please use this feature inside a Rails-Application') unless defined? Rails
39
- LostInTranslation.recent
39
+ LostInTranslationMain.recent
40
40
  end
41
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lost_in_translation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Datyv