Module: Idiom::Directories
- Included in:
- Base
- Defined in:
- lib/idiom/base.rb
Overview
Finds English language translation keys which have not been translated and translates them through Google Translate.
Instance Method Summary collapse
- #destination_file_or_directory(lang) ⇒ Object
- #destination_path(lang) ⇒ Object
- #ensure_destination_path_exists(lang) ⇒ Object
-
#use_directories? ⇒ Boolean
:nodoc:.
Instance Method Details
#destination_file_or_directory(lang) ⇒ Object
27 28 29 30 31 32 33 34 |
# File 'lib/idiom/base.rb', line 27 def destination_file_or_directory(lang) if use_directories? dir = File.dirname(destination_path(lang)) "#{dir}/*.#{extension}" else destination_path(lang) end end |
#destination_path(lang) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/idiom/base.rb', line 10 def destination_path(lang) output_path = File.basename(@base_source).split(".").first if use_directories? "#{destination}/#{lang}/#{output_path}_#{lang}.#{extension}" else "#{destination}/#{output_path}_#{lang}.#{extension}" end end |
#ensure_destination_path_exists(lang) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/idiom/base.rb', line 19 def ensure_destination_path_exists(lang) dest = destination_path(lang) dir = File.dirname(dest) FileUtils.mkdir_p(dir) dest end |
#use_directories? ⇒ Boolean
:nodoc:
6 7 8 |
# File 'lib/idiom/base.rb', line 6 def use_directories? use_dirs end |