Skip to content
Browse files

fixed i18n_filter

  • Loading branch information...
1 parent e4b5e13 commit a707de0e99fe6d5bc7e297c8aca50f6804698fa5 @gacha committed Apr 9, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 _layouts/post.html
  2. +3 −3 _plugins/i18n_filter.rb
View
2 _layouts/post.html
@@ -29,7 +29,7 @@
</article>
<aside>
<h4>Publicēts</h4>
- <time>{{ page.date | localize: ":long_date" }}</time>
+ <time datetime="{{ page.date }}">{{ page.date | localize: ":long_date" }}</time>
{% unless page.tags == empty %}
<h4>Tagi</h4>
<ul class="tag_box">
View
6 _plugins/i18n_filter.rb
@@ -15,10 +15,10 @@ def localize(input, format=nil)
end
def load_translations
- #unless I18n::backend.instance_variable_get(:@translations)
- I18n.backend.load_translations Dir['../_locales/*.yml']
+ unless I18n::backend.instance_variable_get(:@translations)
@TiagoTT
TiagoTT added a note Sep 30, 2014

I noticed that this condition was always true and the translation files were never loaded.

The variable being tested is a hash and even an empty hash evaluates to true, making necessary the use of .empty? method.

In order to get this plugin to work I had to change this line into:

if I18n::backend.instance_variable_get(:@translations).empty?
@gacha
Owner
gacha added a note Oct 1, 2014

Yes, you are right, I will add this change. Looks a bit cleaner I18n.backend.send(:translations).empty?

@TiagoTT
TiagoTT added a note Oct 3, 2014

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ I18n.backend.load_translations Dir[File.join(File.dirname(__FILE__),'../_locales/*.yml')]
I18n.locale = LOCALE
- #end
+ end
end
end
end

0 comments on commit a707de0

Please sign in to comment.
Something went wrong with that request. Please try again.