aboutsummaryrefslogtreecommitdiffstats
path: root/guides
diff options
context:
space:
mode:
authorSeiei Miyagi <hanachin@gmail.com>2015-05-10 22:00:23 +0900
committerSeiei Miyagi <hanachin@gmail.com>2015-10-05 23:53:04 +0900
commitb2e490ef54ab18cce901976697f4f012310a3d12 (patch)
tree38f3439790a482f3074207138aeccd53d7eadb79 /guides
parentc468d7fedd88e2474fd74e804a954a154674c8a0 (diff)
downloadrails-b2e490ef54ab18cce901976697f4f012310a3d12.tar.gz
rails-b2e490ef54ab18cce901976697f4f012310a3d12.tar.bz2
rails-b2e490ef54ab18cce901976697f4f012310a3d12.zip
Add ability to translate rails guides documents.yaml
Some translations of rails guides has their own documents.yaml, for example Japanese: https://github.com/yasslab/railsguides.jp/blob/japanese/guides/source/documents.yaml Traditional Chinese: https://github.com/docrails-tw/guides/blob/master/rails_guides/helpers.rb#L21,L27 https://github.com/docrails-tw/guides/blob/master/source/documents_zh-TW.yaml The [Translating Rails Guides](https://github.com/rails/docrails/wiki/translating-rails-guides) says > Copy the contents of guides/source into your own language directory and translate them. So that sounds ok to copy guides/source/documents.yaml into language specific directly and translating them like other markdown files.
Diffstat (limited to 'guides')
-rw-r--r--guides/rails_guides/generator.rb2
-rw-r--r--guides/rails_guides/helpers.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/guides/rails_guides/generator.rb b/guides/rails_guides/generator.rb
index 43f6f7eecf..b7a94f144c 100644
--- a/guides/rails_guides/generator.rb
+++ b/guides/rails_guides/generator.rb
@@ -194,7 +194,7 @@ module RailsGuides
layout = kindle? ? 'kindle/layout' : 'layout'
File.open(output_path, 'w') do |f|
- view = ActionView::Base.new(source_dir, :edge => @edge, :version => @version, :mobi => "kindle/#{mobi}")
+ view = ActionView::Base.new(source_dir, :edge => @edge, :version => @version, :mobi => "kindle/#{mobi}", :lang => @lang)
view.extend(Helpers)
if guide =~ /\.(\w+)\.erb$/
diff --git a/guides/rails_guides/helpers.rb b/guides/rails_guides/helpers.rb
index a78c2e9fca..38d5919159 100644
--- a/guides/rails_guides/helpers.rb
+++ b/guides/rails_guides/helpers.rb
@@ -15,7 +15,7 @@ module RailsGuides
end
def documents_by_section
- @documents_by_section ||= YAML.load_file(File.expand_path('../../source/documents.yaml', __FILE__))
+ @documents_by_section ||= YAML.load_file(File.expand_path("../../source/#@lang/documents.yaml", __FILE__))
end
def documents_flat