fix issue #8
did
committed Mar 17, 2013
commit c062323942a31e4d202ccd33892ced3fef8e3a3d
Showing 12
changed files with
143 additions
and 76 deletions
locomotive/wagon/liquid/tags/locale_switcher.rb b/lib/locomotive/wagon/liquid/tags/locale_switcher.rb
+2
-76
| @@ | @@ -76,7 +76,7 @@ module Locomotive |
| def link_label(locale) | |
| case @options[:label] | |
| when 'iso' then locale | |
| - | when 'locale' then I18n.t("locomotive.locales.#{locale}", locale: locale) |
| + | when 'locale' then I18n.t("locales.#{locale}") |
| when 'title' then @page.title # FIXME: this returns nil if the page has not been translated in the locale | |
| else | |
| locale | |
| @@ | @@ -84,8 +84,6 @@ module Locomotive |
| end | |
| def localized_fullpath(locale) | |
| - | # @site.localized_page_fullpath(@page, locale) |
| - | |
| return nil if @page.fullpath_translations.blank? | |
| fullpath = @page.safe_fullpath || @page.fullpath_or_default | |
| @@ | @@ -105,76 +103,4 @@ module Locomotive |
| end | |
| end | |
| end | |
| - | end |
| - | # module Locomotive |
| - | # module Wagon |
| - | # module Liquid |
| - | # module Tags |
| - | |
| - | # # Display the links to change the locale of the current page |
| - | # # |
| - | # # Usage: |
| - | # # |
| - | # # {% locale_switcher %} => <div id="locale-switcher"><a href="/features" class="current en">Features</a><a href="/fr/fonctionnalites" class="fr">Fonctionnalités</a></div> |
| - | # # |
| - | # # {% locale_switcher label: locale, sep: ' - ' } |
| - | # # |
| - | # # options: |
| - | # # - label: iso (de, fr, en, ...etc), locale (Deutsch, Français, English, ...etc), title (page title) |
| - | # # - sep: piece of html code separating 2 locales |
| - | # # |
| - | # # notes: |
| - | # # - "iso" is the default choice for label |
| - | # # - " | " is the default separating code |
| - | # # |
| - | # class LocaleSwitcher < ::Liquid::Tag |
| - | |
| - | # Syntax = /(#{::Liquid::Expression}+)?/ |
| - | |
| - | # def initialize(tag_name, markup, tokens, context) |
| - | # @options = { label: 'iso', sep: ' | ' } |
| - | |
| - | # if markup =~ Syntax |
| - | # markup.scan(::Liquid::TagAttributes) { |key, value| @options[key.to_sym] = value.gsub(/"|'/, '') } |
| - | |
| - | # @options[:exclude] = Regexp.new(@options[:exclude]) if @options[:exclude] |
| - | # else |
| - | # raise ::Liquid::SyntaxError.new("Syntax Error in 'locale_switcher' - Valid syntax: locale_switcher <options>") |
| - | # end |
| - | |
| - | # super |
| - | # end |
| - | |
| - | # def render(context) |
| - | # @site, @page = context.registers[:site], context.registers[:page] |
| - | |
| - | # output = %(<div id="locale-switcher">) |
| - | |
| - | # output += @site.locales.collect do |locale| |
| - | # fullpath = locale.to_s == context['default_locale'].to_s ? '/' : locale |
| - | |
| - | # %(<a href="/#{fullpath}" class="#{locale} #{'current' if locale.to_s == context['default_locale'].to_s}">#{link_label(locale)}</a>) |
| - | # end.join(@options[:sep]) |
| - | |
| - | # output += %(</div>) |
| - | # end |
| - | |
| - | # private |
| - | |
| - | # def link_label(locale) |
| - | # case @options[:label] |
| - | # when :iso then locale |
| - | # when :locale then I18n.t("locomotive.locales.#{locale}", locale: locale) |
| - | # when :title then @page.title # FIXME: this returns nil if the page has not been translated in the locale |
| - | # else |
| - | # locale |
| - | # end |
| - | # end |
| - | |
| - | # end |
| - | |
| - | # ::Liquid::Template.register_tag('locale_switcher', LocaleSwitcher) |
| - | # end |
| - | # end |
| - | # end |
| - | # end |
| \ No newline at end of file | |
| + | end |
| \ No newline at end of file | |
locales/de.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| de: | |
| + | locales: |
| + | en: Englisch |
| + | de: Deutsch |
| + | fr: Französisch |
| + | pl: Polnisch |
| + | pt-BR: "Bras. Portugiesisch" |
| + | it: Italienisch |
| + | nl: Niederländisch |
| + | nb: Norwegisch |
| + | es: Spanisch |
| + | ru: Russisch |
| + | et: Estnisch |
| + | |
| errors: | |
| messages: | |
| blank: "leer" | |
locales/en.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| en: | |
| + | locales: |
| + | en: English |
| + | de: German |
| + | fr: French |
| + | pl: Polish |
| + | pt-BR: "Brazilian Portuguese" |
| + | it: Italian |
| + | nl: Dutch |
| + | nb: Norwegian |
| + | es: Spanish |
| + | ru: Russian |
| + | et: Estonian |
| + | |
| errors: | |
| messages: | |
| blank: "can't not blank" | |
locales/es.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| es: | |
| + | locales: |
| + | en: Inglés |
| + | de: Alemán |
| + | fr: Francés |
| + | pl: polaco |
| + | pt-BR: "Portugués (Brasil)" |
| + | it: Italiano |
| + | nl: holandés |
| + | nb: Noruego |
| + | es: Español |
| + | ru: Ruso |
| + | et: Estonio |
| + | |
| errors: | |
| messages: | |
| blank: "no puede estar en blanco" | |
locales/et.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| et: | |
| + | locales: |
| + | en: Inglise |
| + | de: Saksa |
| + | fr: Prantsuse |
| + | pl: Poola |
| + | pt-BR: "Brasiilia Portugali" |
| + | it: Itaalia |
| + | nl: Hollandi |
| + | nb: Norra |
| + | es: Hispaania |
| + | ru: Vene |
| + | et: Eesti |
| + | |
| errors: | |
| messages: | |
| blank: "tühi" | |
locales/fr.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| fr: | |
| + | locales: |
| + | en: Anglais |
| + | de: Allemand |
| + | fr: Français |
| + | pl: Polonais |
| + | pt-BR: "Portugais" |
| + | it: "Italien" |
| + | nl: "Hollandais" |
| + | nb: "Norvégien" |
| + | es: Espagnol |
| + | ru: Russe |
| + | et: Estonien |
| + | |
| errors: | |
| messages: | |
| blank: "doit être rempli(e)" | |
locales/it.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| it: | |
| + | locales: |
| + | en: Inglese |
| + | de: Tedesco |
| + | fr: Francese |
| + | pl: Polacco |
| + | pt-BR: "Portoghese Brasiliano" |
| + | it: Italiano |
| + | nl: Olandese |
| + | nb: Norvegese |
| + | es: Spagnolo |
| + | ru: Russo |
| + | et: Estone |
| + | |
| errors: | |
| messages: | |
| blank: "non può essere lasciato in bianco" | |
locales/nb.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| nb: | |
| + | locales: |
| + | en: Engelsk |
| + | de: Tysk |
| + | fr: Fransk |
| + | pl: Polsk |
| + | pt-BR: "Brazilian Portuguese" |
| + | it: Italiensk |
| + | nl: Nederlandsk |
| + | nb: Norsk |
| + | es: Spansk |
| + | ru: Russisk |
| + | et: Estisk |
| + | |
| date: | |
| formats: | |
| default: "%d.%m.%Y" | |
locales/nl.yml
+11
-0
| @@ | @@ -1,4 +1,15 @@ |
| nl: | |
| + | locales: |
| + | en: Engels |
| + | de: Duits |
| + | fr: Frans |
| + | pt-BR: "Braziliaans Portugees" |
| + | it: Italiaans |
| + | nl: Nederlands |
| + | nb: Noors |
| + | ru: Russisch |
| + | et: Estlands |
| + | |
| errors: | |
| messages: | |
| blank: "kan ikke være blank" | |
locales/pl.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| pl: | |
| + | locales: |
| + | en: angielski |
| + | de: niemiecki |
| + | fr: francuski |
| + | pl: polski |
| + | pt-BR: "portugalski (brazylijski)" |
| + | it: włoski |
| + | nl: niderlandzki |
| + | nb: norweski |
| + | es: hiszpański |
| + | ru: rosyjski |
| + | et: estoński |
| + | |
| errors: | |
| messages: | |
| blank: "nie może być puste" | |
locales/pt-BR.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| pt-BR: | |
| + | locales: |
| + | en: Inglês |
| + | de: Alemão |
| + | fr: Francês |
| + | pl: Polonês |
| + | pt-BR: "Português do Brasil" |
| + | it: Italiano |
| + | nl: Holandês |
| + | nb: Norueguês |
| + | es: Espanhol |
| + | ru: Russo |
| + | et: Estoniano |
| + | |
| errors: | |
| messages: | |
| blank: "não pode ficar em branco" | |
locales/ru.yml
+13
-0
| @@ | @@ -1,4 +1,17 @@ |
| ru: | |
| + | locales: |
| + | en: Английский |
| + | de: Немецкий |
| + | fr: Французский |
| + | pl: Польский |
| + | pt-BR: "Браз. - Португальский" |
| + | it: Итальянский |
| + | nl: Голландский |
| + | nb: Норвежский |
| + | es: Испанский |
| + | ru: Русский |
| + | et: Эстонский |
| + | |
| errors: | |
| messages: | |
| blank: "can not be blank" | |