summaryrefslogtreecommitdiff
path: root/lib/rss
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rss')
-rw-r--r--lib/rss/maker/1.0.rb1
-rw-r--r--lib/rss/maker/base.rb19
-rw-r--r--lib/rss/maker/feed.rb2
3 files changed, 22 insertions, 0 deletions
diff --git a/lib/rss/maker/1.0.rb b/lib/rss/maker/1.0.rb
index 676f662915b..0d8075f836c 100644
--- a/lib/rss/maker/1.0.rb
+++ b/lib/rss/maker/1.0.rb
@@ -25,6 +25,7 @@ module RSS
end
class Channel < ChannelBase
+ include SetupDefaultLanguage
def to_feed(rss)
set_default_values do
diff --git a/lib/rss/maker/base.rb b/lib/rss/maker/base.rb
index 615088f8f79..6b42f11fcb1 100644
--- a/lib/rss/maker/base.rb
+++ b/lib/rss/maker/base.rb
@@ -372,6 +372,25 @@ module RSS
end
end
+ module SetupDefaultLanguage
+ private
+ def _set_default_values(&block)
+ keep = {
+ :dc_languages => dc_languages.to_a.dup,
+ }
+ _language = language
+ if _language and
+ !dc_languages.any? {|dc_language| dc_language.value == _language}
+ dc_language = self.class::DublinCoreLanguages::DublinCoreLanguage.new(self)
+ dc_language.value = _language.dup
+ dc_languages.unshift(dc_language)
+ end
+ super(&block)
+ ensure
+ dc_languages.replace(keep[:dc_languages])
+ end
+ end
+
class RSSBase < Base
class << self
def make(*args, &block)
diff --git a/lib/rss/maker/feed.rb b/lib/rss/maker/feed.rb
index 3a30ad42874..fa3a1771608 100644
--- a/lib/rss/maker/feed.rb
+++ b/lib/rss/maker/feed.rb
@@ -22,6 +22,8 @@ module RSS
end
class Channel < ChannelBase
+ include SetupDefaultLanguage
+
def to_feed(feed)
set_default_values do
setup_values(feed)