On Fri, Nov 20, 2009 at 07:15:02PM +0100, Stefan Schubert wrote:
> ref: refs/heads/master
> commit fec94faa8960f68547a1980ff6d4df634e31dd57
> Author: Stefan Schubert <[email protected]>
> Date:   Fri Nov 20 19:15:02 2009 +0100
> 
>     evaluate the state of each translation and suggest to delete it if it is 
> unsufficent
> ---
>  Rakefile                         |   24 ++++++++++++++++++++++++
>  webclient/lib/tasks/gettext.rake |   27 +++++++++++++++++++++++++++
>  2 files changed, 51 insertions(+), 0 deletions(-)
> 
> diff --git a/Rakefile b/Rakefile
> index 184c6cf..a1b8f72 100644
> --- a/Rakefile
> +++ b/Rakefile

NOOOOO!!

You have hijacked the top level Rakefile to suit your particular
specialized task. Please revert it and create the fetch_po task
separately.

> @@ -8,12 +8,36 @@ task :default => :test
>  
>  %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
> +    if task_name == "fetch_po"
> +      #remove translation statistik
> +      File.delete(File.join("pot", "translation_status.yaml")) if 
> File.exist?("pot/translation_status.yaml")
> +    end
> +
>      PROJECTS.each do |project|
>        system %(cd #{project} && #{env} #{$0} #{task_name})
>        raise "Error on execute task #{task_name} on #{project}" if 
> $?.exitstatus != 0
>      end
> +
> +    if task_name == "fetch_po"
> +      #remove translations which have not at least 80 percent translated text
> +      limit = Float(80)

Bonus points for a well hidden constant.
It should be TRANSLATION_LIMIT = 80 near the top of the file.

> +      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."
> +        end      
> +     }
> +    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
-- 
Martin Vidner, YaST developer
http://en.opensuse.org/User:Mvidner

Kuracke oddeleni v restauraci je jako fekalni oddeleni v bazenu

Attachment: pgpZnzYMJwuTQ.pgp
Description: PGP signature

Reply via email to