From 4399266aebfb52af2ccf51a37c146c18b5a1a132 Mon Sep 17 00:00:00 2001 From: Sebastian Celis Date: Thu, 9 Feb 2012 09:48:08 -0600 Subject: [PATCH] Move another method into the StringsRow class. --- lib/twine/formatters/abstract.rb | 4 ---- lib/twine/formatters/android.rb | 2 +- lib/twine/formatters/apple.rb | 2 +- lib/twine/stringsfile.rb | 4 ++++ 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/twine/formatters/abstract.rb b/lib/twine/formatters/abstract.rb index 277db5f..72e250c 100644 --- a/lib/twine/formatters/abstract.rb +++ b/lib/twine/formatters/abstract.rb @@ -33,10 +33,6 @@ module Twine end end end - - def translated_string_for_row_and_lang(row, lang, default_lang) - row.translations[lang] || row.translations[default_lang] - end end end end diff --git a/lib/twine/formatters/android.rb b/lib/twine/formatters/android.rb index ee3c926..7011d2b 100644 --- a/lib/twine/formatters/android.rb +++ b/lib/twine/formatters/android.rb @@ -89,7 +89,7 @@ module Twine key = row.key key = CGI.escapeHTML(key) - value = translated_string_for_row_and_lang(row, lang, default_lang) + value = row.translated_string_for_and_lang(lang, default_lang) value.gsub!('\'', '\\\\\'') value.gsub!('%@', '%s') value = CGI.escapeHTML(value) diff --git a/lib/twine/formatters/apple.rb b/lib/twine/formatters/apple.rb index 4d3699e..fb2d73b 100644 --- a/lib/twine/formatters/apple.rb +++ b/lib/twine/formatters/apple.rb @@ -63,7 +63,7 @@ module Twine key = row.key key = key.gsub('"', '\\\\"') - value = translated_string_for_row_and_lang(row, lang, default_lang) + value = row.translated_string_for_and_lang(lang, default_lang) value = value.gsub('"', '\\\\"') comment = row.comment diff --git a/lib/twine/stringsfile.rb b/lib/twine/stringsfile.rb index 876acda..f3e67e3 100644 --- a/lib/twine/stringsfile.rb +++ b/lib/twine/stringsfile.rb @@ -38,6 +38,10 @@ module Twine return false end + + def translated_string_for_lang(lang, default_lang=nil) + row.translations[lang] || row.translations[default_lang] + end end class StringsFile