Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

We’re showing branches in this repository, but you can also compare across forks.

base fork: yeah/radiant-multilingual-pages-extension
base: master
...
head fork: siuying/radiant-multilingual-pages-extension
compare: master
  • 8 commits
  • 3 files changed
  • 1 commit comment
  • 3 contributors
4 app/views/admin/pages/_multilingual_slugs.html.haml
View
@@ -1,9 +1,9 @@
- if @page.is_a?(MultilingualPage)
- %div.row
+ %div.row.multilang
%table.fieldset
%tr
%th.label
%label{:for => "page_multilingual_slugs"}
= 'Multilingual slugs (e.g. "en=home;de=startseite")'
%td.field
- = text_field :page, :multilingual_slugs, :class => 'textbox', :maxlength => 160, :size => 160
+ = text_field :page, :multilingual_slugs, :class => 'textbox', :maxlength => 160, :size => 160
4 lib/non_multilingual_page_extensions.rb
View
@@ -48,7 +48,7 @@ def needs_language_detection?
MultilingualPagesExtension::USE_LANGUAGE_DETECTION and (not parent?) and Thread.current[:requested_language].nil?
end
- def languages
+ def multilingual_languages
langs = (request.env["HTTP_ACCEPT_LANGUAGE"] || "").split(/[,\s]+/)
langs_with_weights = langs.map do |ele|
both = ele.split(/;q=/)
@@ -59,7 +59,7 @@ def languages
end
def location
- language = languages.detect{|l| MultilingualPagesExtension::AVAILABLE_LANGUAGES.include?(l)} || MultilingualPagesExtension::DEFAULT_LANGUAGE
+ language = multilingual_languages.detect{|l| MultilingualPagesExtension::AVAILABLE_LANGUAGES.include?(l)} || MultilingualPagesExtension::DEFAULT_LANGUAGE
path = clean_url("#{request.path}/#{MultilingualPagesExtension::NON_MULTILINGUAL_ROUTE}#{language}")
"#{request.protocol}#{request.host_with_port}#{path}" << (request.query_string.blank? ? '' : "?#{request.query_string}")
end
6 multilingual_pages_extension.rb
View
@@ -22,7 +22,7 @@ def activate
end
# adapt page edit admin ui
- admin.page.edit.add(:form, "multilingual_slugs", :before => 'edit_extended_metadata')
+ admin.page.edit.add(:extended_metadata, "multilingual_slugs", :before => 'edit_extended_metadata')
# enable tags in regular and multilingual pages
MultilingualPage.send(:include, MultilingualPageTags)
@@ -131,7 +131,7 @@ def deactivate
'is' => 'Íslenska',
'it' => 'Italiano',
'iu' => 'ᐃᓄᒃᑎᑐᑦ',
- 'ja' => '日本語 (にほんご/にっぽんご)',
+ 'ja' => '日本語',
'jv' => 'basa Jawa',
'ka' => 'ქართული',
'kg' => 'KiKongo',
@@ -238,7 +238,7 @@ def deactivate
'yi' => 'ייִדיש',
'yo' => 'Yorùbá',
'za' => 'Saɯ cueŋƅ, Saw cuengh',
- 'zh' => '中文 (Zhōngwén), 汉语, 漢語',
+ 'zh' => '中文',
'zu' => 'isiZulu'
}
end

Showing you all comments on commits in this comparison.

Francis Chong

have to rename the languages to multilingual_languages, or the auto detect language feature is not working

Something went wrong with that request. Please try again.