Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added support for generating translated guides (stored in `source/<LA…

…NG>`) via setting the LANG environment variable
  • Loading branch information...
commit 56221faecdb47163cb463531506821aa6ba50370 1 parent 65d3899
Karel Minarik karmi authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 railties/guides/rails_guides/generator.rb
9 railties/guides/rails_guides/generator.rb
View
@@ -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 @@ class Generator
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 @@ def generate
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
Please sign in to comment.
Something went wrong with that request. Please try again.