Mailinglist Archive: yast-commit (553 mails)

< Previous Next >
[yast-commit] <web-client> backgroud_patches_bnc550934 : Revert "moved fetch_po to an own task in the top level Rakefile" revert schubis cosmetic changes This reverts commit 1a2a92a6252478730fd3d7e6f0be5c35e2d44663.
  • From: J.Daniel Schmidt <jdsn@xxxxxxx>
  • Date: Tue, 24 Nov 2009 11:08:16 +0100
  • Message-id: <E1NLfcn-0004iy-Jn@xxxxxxxxxxxxxxxx>
ref: refs/heads/backgroud_patches_bnc550934
commit da7293ffd2044052fa1096dd07f8638330b26cd0
Author: J. Daniel Schmidt <jdsn@xxxxxxx>
Date: Tue Nov 24 11:08:16 2009 +0100

Revert "moved fetch_po to an own task in the top level Rakefile"
revert schubis cosmetic changes
This reverts commit 1a2a92a6252478730fd3d7e6f0be5c35e2d44663.
---
Rakefile | 84 ++++++++++++--------------------------
webclient/lib/tasks/gettext.rake | 27 ++++++++++++
2 files changed, 53 insertions(+), 58 deletions(-)

diff --git a/Rakefile b/Rakefile
index 042a48c..21f8667 100644
--- a/Rakefile
+++ b/Rakefile
@@ -8,74 +8,42 @@ desc 'Run all tests by default'
task :default => :test


-%w(makemo updatepot test test:ui rdoc pgem package release install
install_policies check_syntax package-local buildrpm buildrpm-local
test:test:rcov).each do |task_name|
+%w(fetch_po makemo updatepot test test:ui rdoc pgem package release install
install_policies check_syntax package-local buildrpm buildrpm-local
test:test:rcov).each do |task_name|
desc "Run #{task_name} task for all projects"
+
task task_name do
+ #remove translation statistik
+ File.delete(File.join("pot", "translation_status.yaml")) if task_name ==
"fetch_po" && File.exist?("pot/translation_status.yaml")
+
PROJECTS.each do |project|
system %(cd #{project} && #{env} #{$0} #{task_name})
raise "Error on execute task #{task_name} on #{project}" if
$?.exitstatus != 0
end
- end
-end

-desc "Fetch po files from lcn. Parameter: source directory of lcn e.g.
...lcn/trunk/webyast/"
-task :fetch_po, [:lcn_dir] do |t, args|
- args.with_defaults(:lcn_dir => File.join(File.dirname(__FILE__),"../../",
"lcn", "trunk","webyast"))
- #remove translation statistik
- File.delete(File.join("pot", "translation_status.yaml")) if
File.exist?("pot/translation_status.yaml")
- result = Hash.new()
-
- PROJECTS.each do |project|
- system %(cd #{project} && #{env} #{$0} fetch_po #{args.lcn_dir})
- raise "Error on execute task fetch_po on #{project}" if $?.exitstatus != 0
-
- #collecting translation information
- Dir.glob("#{project}/**/*.po").each {|po_file|
- output = `LANG=C msgfmt -o /dev/null -c -v --statistics #{po_file} 2>&1`
- language = File.basename(File.dirname(po_file))
- output.split(",").each {|column|
- value = column.split(" ")
- if value.size > 2
- if result.has_key? language
- if result[language].has_key? value[1]
- result[language][value[1]] += value[0].to_i
- else
- result[language][value[1]] = value[0].to_i
+ if task_name == "fetch_po"
+ #remove translations which have not at least 80 percent translated text
+ limit = Float(80)
+ result = Hash.new
+ result = YAML.load(File.open(File.join("pot",
"translation_status.yaml"))) if File.exists?(File.join("pot",
"translation_status.yaml"))
+ result.each {|key,value|
+ translated = un_translated = Float(0)
+ translated = value["translated"].to_f if value.has_key? "translated"
+ un_translated += value["untranslated"].to_f if value.has_key?
"untranslated"
+ un_translated += value["fuzzy"].to_f if value.has_key? "fuzzy"
+ limit_eval = translated/(un_translated+translated)
+ if limit_eval < limit/100
+ puts "Language #{key} should be deleted cause it has only
#{(limit_eval*100).to_i} percent translation reached."
+ Dir.glob("**/#{key}/").each {|po_dir|
+ unless po_dir.include? "lang_helper" #do not delete translations
for language selections
+# puts "deleting #{po_dir}"
+# remove_dir(po_dir, true) #force=true
end
- else
- result[language] = Hash.new
- result[language][value[1]] = value[0].to_i
- end
- end
- }
- }
+ }
+ end
+ }
+ end
end
-
- #saving result to pot/translation_status.yaml
- destdir = File.join(File.dirname(__FILE__), "pot")
- Dir.mkdir destdir unless File.directory?(destdir)
- f = File.open(File.join(destdir, "translation_status.yaml"), "w")
- f.write(result.to_yaml)
- f.close

- #remove translations which have not at least 80 percent translated text
- limit = Float(80)
- result.each {|key,value|
- translated = un_translated = Float(0)
- translated = value["translated"].to_f if value.has_key? "translated"
- un_translated += value["untranslated"].to_f if value.has_key?
"untranslated"
- un_translated += value["fuzzy"].to_f if value.has_key? "fuzzy"
- limit_eval = translated/(un_translated+translated)
- if limit_eval < limit/100
- puts "Language #{key} should be deleted cause it has only
#{(limit_eval*100).to_i} percent translation reached."
- Dir.glob("**/#{key}/").each {|po_dir|
- unless po_dir.include? "lang_helper" #do not delete translations for
language selections
-# puts "deleting #{po_dir}"
-# remove_dir(po_dir, true) #force=true
- end
- }
- end
- }
end

desc "Run doc to generate whole documentation"
diff --git a/webclient/lib/tasks/gettext.rake b/webclient/lib/tasks/gettext.rake
index 972de14..d0a00dc 100644
--- a/webclient/lib/tasks/gettext.rake
+++ b/webclient/lib/tasks/gettext.rake
@@ -51,5 +51,32 @@ task :fetch_po, [:lcn_dir] do |t, args|
FileUtils.cp(po_file, destfile)
end
}
+ result = Hash.new()
+ destdir = File.join(File.dirname(__FILE__),"../../..", "pot")
+ Dir.mkdir destdir unless File.directory?(destdir)
+ result = YAML.load(File.open(File.join(destdir, "translation_status.yaml")))
if File.exists?(File.join(destdir, "translation_status.yaml"))
+
+ Dir.glob("{po}/**/*.po").each {|po_file|
+ output = `LANG=C msgfmt -o /dev/null -c -v --statistics #{po_file} 2>&1`
+ language = File.basename(File.dirname(po_file))
+ output.split(",").each {|column|
+ value = column.split(" ")
+ if value.size > 2
+ unless result[language].blank?
+ unless result[language][value[1]].blank?
+ result[language][value[1]] += value[0].to_i
+ else
+ result[language][value[1]] = value[0].to_i
+ end
+ else
+ result[language] = Hash.new
+ result[language][value[1]] = value[0].to_i
+ end
+ end
+ }
+ }
+ f = File.open(File.join(destdir, "translation_status.yaml"), "w")
+ f.write(result.to_yaml)
+ f.close
end

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages