spree_i18n 1.0.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/.rspec +3 -0
  4. data/.rubocop.yml +7 -0
  5. data/.travis.yml +44 -0
  6. data/Appraisals +9 -0
  7. data/CONTRIBUTING.md +81 -0
  8. data/Gemfile +6 -0
  9. data/LICENSE.md +26 -0
  10. data/README.md +95 -9
  11. data/Rakefile +86 -0
  12. data/bin/rails +7 -0
  13. data/config/initializers/country_names.rb +51 -0
  14. data/config/locales/ar.yml +1341 -0
  15. data/config/locales/be.yml +1419 -0
  16. data/config/locales/bg.yml +1441 -0
  17. data/config/locales/ca.yml +1253 -1126
  18. data/config/locales/cs.yml +1363 -0
  19. data/config/locales/da.yml +1330 -1191
  20. data/config/locales/de-CH.yml +1284 -1202
  21. data/config/locales/de.yml +1928 -1113
  22. data/config/locales/en-AU.yml +1241 -1113
  23. data/config/locales/en-GB.yml +1249 -1117
  24. data/config/locales/en-IN.yml +1241 -1111
  25. data/config/locales/en-NZ.yml +1248 -1120
  26. data/config/locales/es-CL.yml +1398 -0
  27. data/config/locales/es-EC.yml +1338 -0
  28. data/config/locales/es-MX.yml +1327 -1196
  29. data/config/locales/es.yml +1785 -1195
  30. data/config/locales/et.yml +1246 -1136
  31. data/config/locales/fa.yml +1139 -1185
  32. data/config/locales/fi.yml +1362 -1200
  33. data/config/locales/fr.yml +1952 -1142
  34. data/config/locales/gr.yml +1336 -0
  35. data/config/locales/id.yml +1335 -0
  36. data/config/locales/it.yml +1391 -1187
  37. data/config/locales/ja.yml +1336 -0
  38. data/config/locales/km.yml +1358 -0
  39. data/config/locales/ko.yml +1292 -1204
  40. data/config/locales/ku.yml +1338 -0
  41. data/config/locales/lt.yml +1497 -1199
  42. data/config/locales/lv.yml +1319 -1194
  43. data/config/locales/nb.yml +1339 -0
  44. data/config/locales/nl.yml +1361 -1124
  45. data/config/locales/pl.yml +1640 -1139
  46. data/config/locales/pt-BR.yml +1512 -1196
  47. data/config/locales/pt.yml +1290 -0
  48. data/config/locales/ro.yml +1335 -0
  49. data/config/locales/ru.yml +1396 -1115
  50. data/config/locales/sk.yml +1339 -1200
  51. data/config/locales/sl-SI.yml +1286 -1204
  52. data/config/locales/sv.yml +1559 -0
  53. data/config/locales/th.yml +1319 -1195
  54. data/config/locales/tr.yml +1291 -0
  55. data/config/locales/uk.yml +1316 -1075
  56. data/config/locales/vi.yml +1296 -0
  57. data/config/locales/zh-CN.yml +1367 -1199
  58. data/config/locales/zh-TW.yml +1821 -1199
  59. data/gemfiles/spree_4_2.gemfile +8 -0
  60. data/gemfiles/spree_master.gemfile +8 -0
  61. data/lib/generators/spree_i18n/install/install_generator.rb +6 -0
  62. data/lib/spree/i18n_utils.rb +26 -20
  63. data/lib/spree_i18n.rb +6 -1
  64. data/lib/spree_i18n/engine.rb +43 -0
  65. data/lib/spree_i18n/locale.rb +13 -0
  66. data/lib/spree_i18n/version.rb +17 -0
  67. data/lib/tasks/spree_i18n/upgrade.rake +43 -0
  68. data/spec/features/russian_errors_translation_spec.rb +16 -0
  69. data/spec/features/translation_spec.rb +38 -0
  70. data/spec/spec_helper.rb +10 -0
  71. data/spec/support/i18n.rb +5 -0
  72. data/spree_i18n.gemspec +31 -0
  73. metadata +94 -110
  74. data/config/locales/cs-CZ.yml +0 -1206
  75. data/config/locales/il.yml +0 -1206
  76. data/config/locales/ja/spree_api.yml +0 -14
  77. data/config/locales/ja/spree_auth.yml +0 -46
  78. data/config/locales/ja/spree_core.rb +0 -16
  79. data/config/locales/ja/spree_core.yml +0 -1071
  80. data/config/locales/ja/spree_dash.yml +0 -5
  81. data/config/locales/ja/spree_promo.yml +0 -88
  82. data/config/locales/nb-NO.yml +0 -1206
  83. data/config/locales/nl-BE.yml +0 -1206
  84. data/config/locales/pt-PT.yml +0 -1206
  85. data/config/locales/sv-SE.yml +0 -1210
  86. data/config/locales/vn.yml +0 -1206
  87. data/default/spree_api.yml +0 -21
  88. data/default/spree_auth.yml +0 -46
  89. data/default/spree_core.yml +0 -1123
  90. data/default/spree_dash.yml +0 -11
  91. data/default/spree_promo.yml +0 -92
  92. data/lib/spree_i18n/railtie.rb +0 -24
  93. data/lib/tasks/i18n.rake +0 -107
@@ -1,11 +0,0 @@
1
- en:
2
- agree_to_terms_of_service: Agree to Terms of Service
3
- agree_to_privacy_policy: Agree to Privacy Policy
4
- already_signed_up_for_analytics: You have already signed up for Spree Analytics
5
- successfully_signed_up_for_analytics: Successfully signed up for Spree Analytics
6
- analytics_desc_header_1: Spree Analytics
7
- analytics_desc_header_2: Live analytics integrated into your Spree dashboard
8
- analytics_desc_list_1: Get live sales information as it happens
9
- analytics_desc_list_2: Requires only a free Spree account to activate
10
- analytics_desc_list_3: Absolutely no code to install
11
- analytics_desc_list_4: It's completely free!
@@ -1,92 +0,0 @@
1
- ---
2
- en:
3
- activerecord:
4
- attributes:
5
- spree/promotion:
6
- advertise: Advertise
7
- code: Code
8
- description: Description
9
- event_name: Event Name
10
- expires_at: Expires At
11
- name: Name
12
- path: Path
13
- starts_at: Starts At
14
- usage_limit: Usage Limit
15
- add_action_of_type: Add action of type
16
- add_rule_of_type: Add rule of type
17
- back_to_promotions_list: "Back To Promotions List"
18
- coupon: Coupon
19
- coupon_code: Coupon code
20
- coupon_code_applied: The coupon code was successfully applied to your order.
21
- editing_promotion: Editing Promotion
22
- events:
23
- spree:
24
- checkout:
25
- coupon_code_added: Coupon code added
26
- content:
27
- visited: Visit static content page
28
- expiry: Expiry
29
- free_shipping: Free Shipping
30
- item_total_rule:
31
- operators:
32
- gt: greater than
33
- gte: greater than or equal to
34
- landing_page_rule:
35
- path: Path
36
- new_promotion: New Promotion
37
- no_rules_added: No rules added
38
- percent_per_item: Percent Per Item
39
- product_rule:
40
- choose_products: Choose products
41
- label: "Order must contain %{select} of these products"
42
- match_any: at least one
43
- match_all: all
44
- product_source:
45
- group: From product group
46
- manual: Manually choose
47
- promotion_not_found: The coupon code you entered doesn't exist. Please try again.
48
- promotion: Promotion
49
- promotion_action: Promotion Action
50
- promotion_actions: Actions
51
- promotion_action_types:
52
- create_adjustment:
53
- name: Create adjustment
54
- description: Creates a promotion credit adjustment on the order
55
- create_line_items:
56
- name: Create line items
57
- description: Populates the cart with the specified quantity of variant
58
- give_store_credit:
59
- name: Give store credit
60
- description: Gives the user store credit of the amount specified
61
- promotion_form:
62
- match_policies:
63
- all: Match all of these rules
64
- any: Match any of these rules
65
- promotions: Promotions
66
- promotions_description: Manage offers and coupons with promotions
67
- promotion_rule: Promotion Rule
68
- promotion_rule_types:
69
- first_order:
70
- name: First order
71
- description: "Must be the customer's first order"
72
- item_total:
73
- name: Item total
74
- description: Order total meets these criteria
75
- landing_page:
76
- name: Landing Page
77
- description: Customer must have visited the specified page
78
- product:
79
- name: Product(s)
80
- description: Order includes specified product(s)
81
- user:
82
- name: User
83
- description: Available only to the specified users
84
- user_logged_in:
85
- name: User Logged In
86
- description: Available only to logged in users
87
- rules: Rules
88
- spree/order:
89
- coupon_code: Coupon Code
90
- user_rule:
91
- choose_users: Choose users
92
-
@@ -1,24 +0,0 @@
1
- module SpreeI18n
2
- class Railtie < ::Rails::Railtie #:nodoc:
3
- initializer 'spree-i18n' do |app|
4
- SpreeI18n::Railtie.instance_eval do
5
- pattern = pattern_from app.config.i18n.available_locales
6
-
7
- add("config/locales/#{pattern}/*.{rb,yml}")
8
- add("config/locales/#{pattern}.{rb,yml}")
9
- end
10
- end
11
-
12
- protected
13
-
14
- def self.add(pattern)
15
- files = Dir[File.join(File.dirname(__FILE__), '../..', pattern)]
16
- I18n.load_path.concat(files)
17
- end
18
-
19
- def self.pattern_from(args)
20
- array = Array(args || [])
21
- array.blank? ? '*' : "{#{array.join ','}}"
22
- end
23
- end
24
- end
@@ -1,107 +0,0 @@
1
- require 'active_support'
2
- require 'spree/i18n_utils'
3
-
4
- namespace :spree_i18n do
5
-
6
- SPREE_MODULES = [ 'api', 'core', 'dash', 'promo' ].freeze
7
-
8
- desc "Update by retrieving the latest Spree locale files"
9
- task :update_default do
10
- puts "Fetching latest Spree locale file to #{locales_dir}"
11
- require "uri"; require "net/https"
12
- SPREE_MODULES.each do |mod|
13
- location = "https://raw.github.com/spree/spree/master/#{mod}/config/locales/en.yml"
14
- begin
15
- uri = URI.parse(location)
16
- http = Net::HTTP.new(uri.host, uri.port)
17
- http.use_ssl = true
18
- http.verify_mode = OpenSSL::SSL::VERIFY_NONE
19
- puts "Getting from #{uri}"
20
- request = Net::HTTP::Get.new(uri.request_uri)
21
- case response = http.request(request)
22
- when Net::HTTPRedirection then location = response['location']
23
- when Net::HTTPClientError, Net::HTTPServerError then response.error!
24
- end
25
- end until Net::HTTPSuccess === response
26
-
27
- File.open("#{default_dir}/spree_#{mod}.yml", 'w') { |file| file << response.body }
28
- end
29
- end
30
-
31
- desc "Syncronize translation files with latest en (adds comments with fallback en value)"
32
- task :sync do
33
- puts "Starting syncronization..."
34
- words = composite_keys
35
- Dir["#{locales_dir}/*.yml"].each do |filename|
36
- basename = File.basename(filename, '.yml')
37
- (comments, other) = Spree::I18nUtils.read_file(filename, basename)
38
- words.each { |k,v| other[k] ||= "#{words[k]}" } #Initializing hash variable as en fallback if it does not exist
39
- other.delete_if { |k,v| !words[k] } #Remove if not defined in en locale
40
- Spree::I18nUtils.write_file(filename, basename, comments, other, false)
41
- end
42
- end
43
-
44
- desc "Create a new translation file based on en"
45
- task :new do
46
- unless locale = env_locale
47
- print "You must provide a valid LOCALE value, for example:\nrake spree:i18:new LOCALE=pt-PT\n"
48
- exit
49
- end
50
-
51
- Spree::I18nUtils.write_file "#{locales_dir}/#{locale}.yml", "#{locale}", '---', composite_keys
52
- print "New locale generated.\n"
53
- print "Don't forget to also download the rails translation from: http://github.com/svenfuchs/rails-i18n/tree/master/rails/locale\n"
54
- end
55
-
56
- desc "Show translation status for all supported locales other than en."
57
- task :stats do
58
- words = composite_keys
59
- words.delete_if { |k,v| !v.match(/\w+/) or v.match(/^#/) }
60
-
61
- results = ActiveSupport::OrderedHash.new
62
- locale = ENV['LOCALE'] || ''
63
- Dir["#{locales_dir}/*.yml"].each do |filename|
64
- # next unless filename.match('_spree')
65
- basename = File.basename(filename, '.yml')
66
-
67
- # next if basename.starts_with?('en')
68
- (comments, other) = Spree::I18nUtils.read_file(filename, basename)
69
- other.delete_if { |k,v| !words[k] } #Remove if not defined in en.yml
70
- other.delete_if { |k,v| !v.match(/\w+/) or v.match(/#/) }
71
-
72
- translation_status = 100 * (other.values.size / words.values.size.to_f)
73
- results[basename] = translation_status
74
- end
75
- puts "Translation status:"
76
- results.sort.each do |basename, translation_status|
77
- puts "#{basename}\t- #{sprintf('%.1f', translation_status)}%"
78
- end
79
- puts
80
- end
81
-
82
- # Returns a composite hash of all relevant translation keys from each of the gems
83
- def composite_keys
84
- Hash.new.tap do |hash|
85
- SPREE_MODULES.each do |mod|
86
- hash.merge! get_translation_keys("spree_#{mod}")
87
- end
88
- end
89
- end
90
-
91
- def get_translation_keys(gem_name)
92
- (dummy_comments, words) = Spree::I18nUtils.read_file(File.dirname(__FILE__) + "/../../default/#{gem_name}.yml", "en")
93
- words
94
- end
95
-
96
- def locales_dir
97
- File.join File.dirname(__FILE__), "/../../config/locales"
98
- end
99
-
100
- def default_dir
101
- File.join File.dirname(__FILE__), "/../../default"
102
- end
103
-
104
- def env_locale
105
- ENV['LOCALE'].presence
106
- end
107
- end