Class: Haml::MagicTranslations::Tasks::UpdatePoFiles
- Inherits:
-
Rake::TaskLib
- Object
- Rake::TaskLib
- Haml::MagicTranslations::Tasks::UpdatePoFiles
- Defined in:
- lib/haml/magic_translations/tasks.rb
Overview
Rake task to generate and update PO files for a project using Haml::MagicTranslations
Example
Rakefile excerpt:
Haml::MagicTranslations::Tasks::UpdatePoFiles.new do |t|
t.text_domain = 'my_project'
t.files = Dir.glob("views/**/*.{rb,haml}") << "lib/my_project.rb"
t.app_version = 'my_project 0.1'
end
Updating PO files in the po
directory will be done by issuing:
rake update_pofiles
Instance Attribute Summary collapse
-
#app_version ⇒ Object
the application information which appears “Project-Id-Version: #app_version” in the pot/po-files.
-
#files ⇒ Object
an Array of target files, that should be parsed for messages.
-
#lang ⇒ Object
update files only for one language - the language specified by this option.
-
#msgmerge ⇒ Object
an array with the options, passed through to the gnu msgmerge tool.
-
#name ⇒ Object
The name of the task.
-
#po_root ⇒ Object
the root directory of po-files.
-
#text_domain ⇒ Object
the textdomain name (see GetText.update_pofiles).
-
#verbose ⇒ Object
true to show verbose messages.
Instance Method Summary collapse
-
#initialize(name = :update_pofiles) {|_self| ... } ⇒ UpdatePoFiles
constructor
A new instance of UpdatePoFiles.
Constructor Details
#initialize(name = :update_pofiles) {|_self| ... } ⇒ UpdatePoFiles
Returns a new instance of UpdatePoFiles.
58 59 60 61 62 63 64 |
# File 'lib/haml/magic_translations/tasks.rb', line 58 def initialize(name = :update_pofiles) @name = name yield self if block_given? define end |
Instance Attribute Details
#app_version ⇒ Object
the application information which appears “Project-Id-Version: #app_version” in the pot/po-files
40 41 42 |
# File 'lib/haml/magic_translations/tasks.rb', line 40 def app_version @app_version end |
#files ⇒ Object
an Array of target files, that should be parsed for messages
37 38 39 |
# File 'lib/haml/magic_translations/tasks.rb', line 37 def files @files end |
#lang ⇒ Object
update files only for one language - the language specified by this option
43 44 45 |
# File 'lib/haml/magic_translations/tasks.rb', line 43 def lang @lang end |
#msgmerge ⇒ Object
an array with the options, passed through to the gnu msgmerge tool
Symbols are automatically translated to options with dashes, example: ++[:no_wrap, :no_fuzzy_matching, :sort_output]++ translated to ++–no-fuzzy-matching –sort-output++.
53 54 55 |
# File 'lib/haml/magic_translations/tasks.rb', line 53 def msgmerge @msgmerge end |
#name ⇒ Object
The name of the task
31 32 33 |
# File 'lib/haml/magic_translations/tasks.rb', line 31 def name @name end |
#po_root ⇒ Object
the root directory of po-files
46 47 48 |
# File 'lib/haml/magic_translations/tasks.rb', line 46 def po_root @po_root end |
#text_domain ⇒ Object
the textdomain name (see GetText.update_pofiles)
34 35 36 |
# File 'lib/haml/magic_translations/tasks.rb', line 34 def text_domain @text_domain end |
#verbose ⇒ Object
true to show verbose messages. default is false
56 57 58 |
# File 'lib/haml/magic_translations/tasks.rb', line 56 def verbose @verbose end |