@@ -12,6 +12,9 @@ def initialize(site,base,layout,lang,posts)
12
12
@dir = File . join ( @lang , news_dir )
13
13
@name = 'index.html'
14
14
15
+ @locales = @site . config [ 'locales' ] [ 'news' ] [ @lang ] ||
16
+ @site . config [ 'locales' ] [ 'news' ] [ 'en' ]
17
+
15
18
process ( @name )
16
19
read_yaml ( File . join ( base , '_layouts' ) , layout )
17
20
@@ -27,10 +30,6 @@ def news_dir
27
30
end
28
31
end
29
32
30
- def locales
31
- @site . config [ 'locales' ] [ 'news' ] [ @lang ] || @site . config [ 'locales' ] [ 'news' ] [ 'en' ]
32
- end
33
-
34
33
def month_names
35
34
month_names = @site . config [ 'locales' ] [ 'month_names' ] [ @lang ]
36
35
month_names ||= @site . config [ 'locales' ] [ 'month_names' ] [ 'en' ]
@@ -51,7 +50,7 @@ def initialize(site,base,lang,year,month,posts)
51
50
@month = month
52
51
@dir = File . join ( @dir , @year . to_s , "%.2d" % @month )
53
52
54
- title = locales [ 'monthly_archive_title' ]
53
+ title = @ locales[ 'monthly_archive_title' ]
55
54
56
55
data [ 'title' ] = title . gsub ( /%Y|%m|%B/ , {
57
56
'%Y' => @year . to_s ,
@@ -73,8 +72,8 @@ def initialize(site,base,lang,year,posts)
73
72
@year = year
74
73
@dir = File . join ( @dir , @year . to_s )
75
74
76
- title = locales [ 'yearly_archive_title' ]
77
- month_link_text = locales [ 'monthly_archive_link' ]
75
+ title = @ locales[ 'yearly_archive_title' ]
76
+ month_link_text = @ locales[ 'monthly_archive_link' ]
78
77
79
78
data [ 'title' ] = title . gsub ( '%Y' , @year . to_s )
80
79
data [ 'year' ] = @year
@@ -105,8 +104,8 @@ class Index < ArchivePage
105
104
def initialize ( site , base , lang , posts )
106
105
super ( site , base , LAYOUT , lang , posts )
107
106
108
- title = locales [ 'recent_news' ]
109
- year_link_text = locales [ 'yearly_archive_link' ]
107
+ title = @ locales[ 'recent_news' ]
108
+ year_link_text = @ locales[ 'yearly_archive_link' ]
110
109
111
110
data [ 'title' ] = title
112
111
data [ 'posts' ] = posts . last ( MAX_POSTS ) . reverse
0 commit comments