diff --git a/app/models/article.rb b/app/models/article.rb index 3ece08c..7b13218 100644 --- a/app/models/article.rb +++ b/app/models/article.rb @@ -390,6 +390,10 @@ class Article < ActiveRecord::Base {} end + def alternate_languages + self.translations.map(&:language) + end + scope :native_translations, :conditions => { :translation_of_id => nil } def translatable? diff --git a/plugins/metadata/lib/ext/article.rb b/plugins/metadata/lib/ext/article.rb index 1a0aa83..435d6b9 100644 --- a/plugins/metadata/lib/ext/article.rb +++ b/plugins/metadata/lib/ext/article.rb @@ -15,8 +15,8 @@ class Article see_also: [], site_name: proc{ |a, c| a.profile.name }, updated_time: proc{ |a, c| a.updated_at.iso8601 }, - 'locale:locale' => proc{ |a, c| a.environment.default_language }, - 'locale:alternate' => proc{ |a, c| a.environment.languages - [a.environment.default_language] }, + 'locale:locale' => proc{ |a, c| a.language || a.environment.default_language }, + 'locale:alternate' => proc{ |a, c| a.alternate_languages }, description: proc{ |a, plugin| ActionView::Base.full_sanitizer.sanitize a.body }, rich_attachment: "", -- libgit2 0.21.2