aboutsummaryrefslogtreecommitdiffstats
path: root/railties/guides
diff options
context:
space:
mode:
authorKarel Minarik <karmi@karmi.cz>2011-01-01 17:54:02 +0100
committerKarel Minarik <karmi@karmi.cz>2011-01-01 18:01:11 +0100
commit56221faecdb47163cb463531506821aa6ba50370 (patch)
treef5d31fea32e7556d32e4ad66ae62d1b1e4d68bd0 /railties/guides
parent65d389955f164714cd6567918c25385e17c5b844 (diff)
downloadrails-56221faecdb47163cb463531506821aa6ba50370.tar.gz
rails-56221faecdb47163cb463531506821aa6ba50370.tar.bz2
rails-56221faecdb47163cb463531506821aa6ba50370.zip
Added support for generating translated guides (stored in `source/<LANG>`) via setting the LANG environment variable
Diffstat (limited to 'railties/guides')
-rw-r--r--railties/guides/rails_guides/generator.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/railties/guides/rails_guides/generator.rb b/railties/guides/rails_guides/generator.rb
index 68d406e31c..e4f9ea4916 100644
--- a/railties/guides/rails_guides/generator.rb
+++ b/railties/guides/rails_guides/generator.rb
@@ -38,6 +38,10 @@
# Note that if you are working on a guide generation will by default process
# only that one, so ONLY is rarely used nowadays.
#
+# LANG
+# Use LANG when you want to generate translated guides in <tt>source/<LANG></tt>
+# folder (such as <tt>source/es</tt>). Ignore it when generating English guides.
+#
# EDGE
# Set to "1" to indicate generated guides should be marked as edge. This
# inserts a badge and changes the preamble of the home page.
@@ -63,6 +67,7 @@ module RailsGuides
GUIDES_RE = /\.(?:textile|html\.erb)$/
def initialize(output=nil)
+ @lang = ENV['LANG']
initialize_dirs(output)
create_output_dir_if_needed
set_flags_from_environment
@@ -76,8 +81,8 @@ module RailsGuides
private
def initialize_dirs(output)
@guides_dir = File.join(File.dirname(__FILE__), '..')
- @source_dir = File.join(@guides_dir, "source")
- @output_dir = output || File.join(@guides_dir, "output")
+ @source_dir = File.join(@guides_dir, "source", @lang.to_s)
+ @output_dir = output || File.join(@guides_dir, "output", @lang.to_s)
end
def create_output_dir_if_needed