app/models/locomotive/extensions/site/locales.rb
# Returns the fullpath of a page in the context of the current locale (I18n.locale)
# or the one passed in parameter. It also depends on the default site locale.
#
# Ex:
#   For a site with its default site locale to 'en'
#   # context 1: i18n.locale is 'en'
#   contact_us.fullpath <= 'contact_us'
#
#   # context 2: i18n.locale is 'fr'
#   contact_us.fullpath <= 'fr/nous_contacter'
#
# @param [ Page ] page The page we want the localized fullpath
# @param [ String ] locale The optional locale in place of the current one
#
# @return [ String ] The localized fullpath according to the current locale
#
Returns the fullpath of a page in the context of the current locale (I18n.locale)
or the one passed in parameter. It also depends on the default site locale.




Returns the fullpath of a page in the context of the current locale ( I18n . locale ) or the one passed in parameter . It also depends on the default site locale .
def localized_page_fullpath(page, locale = nil)
          return nil if page.fullpath_translations.blank?
          locale    = (locale || I18n.locale).to_s
          fullpath  = page.fullpath_translations[locale] || page.fullpath_translations[self.default_locale]
          if locale == self.default_locale.to_s 
            page.index? ? '' : fullpath
          elsif page.index? 
            locale
          else
            File.join(locale, fullpath)
          end
        end
def localized_page_fullpath ( page , locale = nil ) return nil if page . fullpath_translations . blank? locale = ( locale || I18n . locale ) . to_s fullpath = page . fullpath_translations [ locale ] || page . fullpath_translations [ self . default_locale ] if locale == self . default_locale . to_s page . index? ? '' : fullpath elsif page . index? locale else File . join ( locale , fullpath ) end end
Returns the fullpath of a page in the context of the current locale (I18n.locale)
or the one passed in parameter.
Returns the fullpath of a page in the context of the current locale ( I18n . locale ) or the one passed in parameter .
# no need to specify the locale # avoid /en/index or /fr/index, prefer /en or /fr instead
The localized fullpath according to the current locale
The localized fullpath according to the current locale
 String 
page
<not_specific>
locale
<not_specific>
<not_specific>
locale The optional locale in place of the current one
locale The optional locale in place of the current one