josevalim-localized_templates 0.2.1 → 0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README CHANGED
@@ -2,7 +2,7 @@ Copyright (c) 2008 José Valim (jose.valim@gmail.com)
2
2
  http://www.pagestacker.com/
3
3
  http://josevalim.blogspot.com/
4
4
  License: MIT
5
- Version: 0.2.1
5
+ Version: 0.3
6
6
 
7
7
  LocalizedTemplates
8
8
  ==================
@@ -13,17 +13,12 @@ You can localize your views using the following naming convention:
13
13
  <tt>pt-BR/projects/index.html.erb</tt>
14
14
  <tt>en-US/projects/edit.rss.builder</tt>
15
15
 
16
- OR:
17
-
18
- <tt>projects/pt-BR/index.html.erb</tt>
19
- <tt>projects/en-US/index.html.erb</tt>
20
-
21
16
  And you can also localize rescue files:
22
17
 
23
18
  <tt>public/pt-BR/404.html</tt>
24
19
  <tt>public/en-US/404.html</tt>
25
20
 
26
- If you don't want to localize a file (like a xml file), simply don't change it and it will be
21
+ If you don't want to localize a file (like a xml file), simply don't move it and it will be
27
22
  rendered as default to all languages.
28
23
 
29
24
  Installation
@@ -1,17 +1,17 @@
1
1
  # = Localized templates
2
2
  #
3
3
  # This feature extends Rails template handling and allows the use of localized
4
- # templates like <code>projects/pt-BR/index.html.erb</code> or
5
- # <code>pt-BR/projects/index.html.erb</code>. The plugin will pick the
6
- # template matching the currently used locale (<code>I18n#locale</code>).
4
+ # templates on the root of your views folder like <code>pt-BR/projects/index.html.erb</code>.
5
+ # The plugin will pick the template matching the currently used locale
6
+ # (<code>I18n#locale</code>).
7
7
  #
8
- # If the localized template isn't found, the plugin will try to render
9
- # <code>prjects/index.html.erb</code>. If <code>index.html.erb</code> doesn't
8
+ # If the localized template isn't found, the plugin will try to render the default
9
+ # <code>projects/index.html.erb</code>. If <code>index.html.erb</code> doesn't
10
10
  # exist, a 404 will be raised.
11
11
  #
12
12
  # If you have a template that is the same for all languages (like a xml file)
13
13
  # just keep it without localization: <code>index.xml.builder</code>.
14
-
14
+ #
15
15
  # Theoretically, we just need to overwrite _pick_template and _pick_partial_template
16
16
  # methods in order to have LocalizedTemplates, but memoize doesn't help
17
17
  # since it doesn't see locale changes and would memoize values for only one locale.
@@ -46,9 +46,6 @@ module ActionView
46
46
  # Try to render locale/controller/action
47
47
  if locale && template = _template_view_path_check("#{locale}/#{template_file_name}")
48
48
  template
49
- # Try to render controller/locale/action
50
- elsif locale && template = _template_view_path_check(template_file_name.gsub(/\//, "/#{locale}/"))
51
- template
52
49
  # Try to render controller/action
53
50
  elsif template = _template_view_path_check(template_file_name)
54
51
  template
@@ -10,7 +10,7 @@ module ActionView
10
10
  if options.has_key?(:collection)
11
11
  render_partial_collection(options)
12
12
  else
13
- _pick_partial_template(partial_path).render_partial(self, options[:object], local_assigns)
13
+ _pick_partial_template(partial_path, I18n.locale).render_partial(self, options[:object], local_assigns)
14
14
  end
15
15
  when ActionView::Helpers::FormBuilder
16
16
  builder_partial_path = partial_path.class.to_s.demodulize.underscore.sub(/_builder$/, '')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: josevalim-localized_templates
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: "0.3"
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Jos\xC3\xA9 Valim"
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-11-29 00:00:00 -08:00
12
+ date: 2008-12-18 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies: []
15
15
 
@@ -69,8 +69,8 @@ test_files:
69
69
  - test/fixtures/layouts/default.html.erb
70
70
  - test/fixtures/projects/index.html.erb
71
71
  - test/fixtures/projects/index.rss.builder
72
- - test/fixtures/projects/en-US/index.rss.builder
73
- - test/fixtures/projects/pt-BR/index.html.erb
72
+ - test/fixtures/en-US/projects/index.rss.builder
73
+ - test/fixtures/pt-BR/projects/index.html.erb
74
74
  - test/fixtures/pt-BR/layouts/default.html.erb
75
75
  - test/fixtures/public/500.html
76
76
  - test/fixtures/public/en-US/404.html