From 77286b6ca5f0d68cb325f92b3f17d5157f780d45 Mon Sep 17 00:00:00 2001 From: Petr Kovar Date: Fri, 17 Apr 2015 10:45:09 +0200 Subject: [PATCH] fix reading .ts file --- CHANGELOG.md | 4 ++++ i18n-translators-tools.gemspec | 4 +++- lib/i18n/processor/ts.rb | 6 ++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e09dc8..61aec8a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +v0.2.7 +====== +* fix reading .ts file + v0.2.6 ====== * compatibility with i18n-0.7.0 diff --git a/i18n-translators-tools.gemspec b/i18n-translators-tools.gemspec index 3613793..c25bffc 100644 --- a/i18n-translators-tools.gemspec +++ b/i18n-translators-tools.gemspec @@ -13,7 +13,7 @@ spec = Gem::Specification.new do |s| s.email = "pejuko@gmail.com" s.authors = ["Petr Kovar"] s.name = 'i18n-translators-tools' - s.version = '0.2.6' + s.version = '0.2.7' s.date = Time.now.strftime("%Y-%m-%d") s.add_dependency('i18n', '>= 0.7.0') s.add_dependency('ya2yaml') @@ -52,6 +52,8 @@ Functions: * statistics Changelog: + v0.2.7 + * fix reading .ts file v0.2.6 * compatible with i18n 0.7.0 * make it works with rails 4.2 diff --git a/lib/i18n/processor/ts.rb b/lib/i18n/processor/ts.rb index 5f272c3..ec12f69 100644 --- a/lib/i18n/processor/ts.rb +++ b/lib/i18n/processor/ts.rb @@ -55,8 +55,10 @@ def import(data) fuzzy = get(message, "translation", "type").to_s.strip entry["flag"] = fuzzy if fuzzy == "obsolete" entry["fuzzy"] = true unless fuzzy.empty? - flag = get(message, "extra-po-flags").to_s.strip - entry["flag"] = flag unless flag.empty? + if entry["fuzzy"] + flag = get(message, "extra-po-flags").to_s.strip + entry["flag"] = flag unless flag.empty? + end entry.delete_if {|k,v| v.to_s.empty?} if key # not key means it can be header of po file converted to ts