i18nliner 0.0.11 → 0.0.12

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.
data/LICENSE.txt CHANGED
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Jon Jensen
1
+ Copyright (c) 2013-2015 Jon Jensen
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -335,7 +335,8 @@ I18nliner requires at least Ruby 1.9.3 and Rails 3.
335
335
 
336
336
  * [i18nliner-js](https://github.com/jenseng/i18nliner-js)
337
337
  * [i18nliner-handlebars](https://github.com/fivetanley/i18nliner-handlebars)
338
+ * [react-i18nliner](https://github.com/jenseng/react-i18nliner)
338
339
 
339
340
  ## License
340
341
 
341
- Copyright (c) 2014 Jon Jensen, released under the MIT license
342
+ Copyright (c) 2015 Jon Jensen, released under the MIT license
@@ -19,13 +19,15 @@ module I18nliner
19
19
  end
20
20
 
21
21
  def normalize_whitespace(default, options)
22
- return default unless default.is_a?(String) || default.is_a?(Hash)
22
+ return default unless default.is_a?(String) || default.is_a?(Hash) || default.is_a?(Array)
23
23
 
24
24
  default = default.dup
25
25
 
26
26
  if default.is_a?(Hash)
27
27
  default.each { |key, value| default[key] = normalize_whitespace(value, options) }
28
28
  return default
29
+ elsif default.is_a?(Array)
30
+ return default.map{|value| value.is_a?(String) ? normalize_whitespace(value, options) : value}
29
31
  end
30
32
 
31
33
  if options[:remove_whitespace]
@@ -39,10 +41,11 @@ module I18nliner
39
41
  end
40
42
 
41
43
  def infer_pluralization_hash(default, translate_options)
42
- return default unless default.is_a?(String) &&
43
- default =~ /\A[\w\-]+\z/ &&
44
+ str = (default.is_a?(Array) && default.size == 1) ? default.first : default
45
+ return default unless str.is_a?(String) &&
46
+ str =~ /\A[\w\-]+\z/ &&
44
47
  translate_options.include?(:count)
45
- {:one => "1 #{default}", :other => "%{count} #{default.pluralize}"}
48
+ {:one => "1 #{str}", :other => "%{count} #{str.pluralize}"}
46
49
  end
47
50
 
48
51
  def infer_key(default, translate_options = {})
@@ -85,6 +85,7 @@ describe I18nliner::Extractors::TranslateCall do
85
85
 
86
86
  it "should transliterate underscored keys according to the default locale" do
87
87
  orig_locale = I18n.default_locale
88
+ I18n.available_locales = [:en, :de]
88
89
  I18n.backend.store_translations(:de, :i18n => {
89
90
  :transliterate => {
90
91
  :rule => {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18nliner
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-16 00:00:00.000000000 Z
12
+ date: 2015-07-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport