Commit b4f458641a99d3504539c530b07f0ef948477cab

Authored by AntonioTerceiro
1 parent e6febcd3

ActionItem523: adding __ as a shortcut for Noosfero.term plus

translation

git-svn-id: https://svn.colivre.coop.br/svn/noosfero/trunk@2302 3f533792-8f58-4932-b0fe-aaf55b0a4547
app/views/shared/user_menu.rhtml
... ... @@ -17,7 +17,7 @@
17 17  
18 18 <li><a href="<%= homepage_path(:profile => current_user.login) %>"
19 19 help="<%= _('Go to your home page.') %>"
20   - ><span class="icon-menu-home"></span><%= Noosfero.term(N_('My Home Page')) %></a></li>
  20 + ><span class="icon-menu-home"></span><%= __('My Home Page') %></a></li>
21 21  
22 22 <!-- li><a href="#"><span class="icon-menu-blog"></span> Meu Blog</a></li -->
23 23  
... ...
lib/noosfero.rb
1   -require 'gettext'
2   -
3 1 module Noosfero
4 2 PROJECT = 'noosfero'
5 3 VERSION = '0.11.0'
... ... @@ -33,7 +31,7 @@ module Noosfero
33 31 end
34 32  
35 33 def self.term(t)
36   - gettext(self.terminology.get(t))
  34 + self.terminology.get(t)
37 35 end
38 36 def self.terminology
39 37 @terminology ||= Noosfero::Terminology::Default.new
... ...
lib/noosfero/core_ext.rb
1 1 require 'noosfero/core_ext/string'
2 2 require 'noosfero/core_ext/integer'
  3 +require 'noosfero/core_ext/object'
... ...
lib/noosfero/core_ext/object.rb 0 → 100644
... ... @@ -0,0 +1,5 @@
  1 +class Object
  2 + def __(*args)
  3 + gettext(Noosfero.term(*args))
  4 + end
  5 +end
... ...
lib/tasks/gettext.rake
... ... @@ -13,6 +13,7 @@ end
13 13 desc "Update pot/po files to match new version."
14 14 task :updatepo do
15 15 require 'gettext/utils'
  16 + GetText::RubyParser::ID << '__'
16 17 GetText::ActiveRecordParser.init(:use_classname => false)
17 18 GetText.update_pofiles(Noosfero::PROJECT, Dir.glob("{app,lib,public/designs}/**/*.{rb,rhtml}"),
18 19 "#{Noosfero::PROJECT} #{Noosfero::VERSION}")
... ...
lib/zen3_terminology.rb
... ... @@ -4,6 +4,7 @@ class Zen3Terminology &lt; Noosfero::Terminology::Custom
4 4 include GetText
5 5  
6 6 def initialize
  7 + # NOTE: the hash values must be marked for translation!!
7 8 super({
8 9 'My Home Page' => N_('My ePortfolio'),
9 10 })
... ...