Permalink
Browse files

Also detect %{variable} in translations.

  • Loading branch information...
1 parent 0b75ce7 commit cc0272d4627bcbb4005d5635ba7d1fdaab0eb6dd @wvanbergen wvanbergen committed with josh Jun 8, 2010
Showing with 3 additions and 3 deletions.
  1. +1 −1 app/models/tolk/translation.rb
  2. +2 −2 test/locales/formats/en.yml
@@ -56,7 +56,7 @@ def value
def self.detect_variables(search_in)
case search_in
- when String then Set.new(search_in.scan(/\{\{(\w+)\}\}/).flatten)
+ when String then Set.new(search_in.scan(/\{\{(\w+)\}\}/).flatten + search_in.scan(/\%\{(\w+)\}/).flatten)
when Array then search_in.inject(Set[]) { |carry, item| carry + detect_variables(item) }
when Hash then search_in.values.inject(Set[]) { |carry, item| carry + detect_variables(item) }
else Set[]
@@ -1,11 +1,11 @@
en:
number: 1
string: I am just a stupid string :(
- variables: "String with variables {{hello}} and {{world}}"
+ variables: "String with variables {{hello}} and %{world}"
variables_in_struct:
zero: "Without variable"
one: "With {{variables}}"
- other: "With even {{more}} {{variables}}"
+ other: "With even %{more} {{variables}}"
number_array: [1, 2, 3]
string_array: ['sun', 'moon']
pluralization:

0 comments on commit cc0272d

Please sign in to comment.