Fix translations bug.
This commit is contained in:
parent
51062fb3fe
commit
e4c84edc74
|
@ -72,13 +72,13 @@ class EventNewsController < ApplicationController
|
||||||
"event_news" => event_news,
|
"event_news" => event_news,
|
||||||
"extras" => {
|
"extras" => {
|
||||||
"widget-title" =>t('event_news.event_news'),
|
"widget-title" =>t('event_news.event_news'),
|
||||||
"title-head" => t('event_news.table.title'),
|
"title-head" => t('event_news.title'),
|
||||||
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
|
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
|
||||||
"place-head" => EventNewsCustomTitle.get_trans('place'),
|
"place-head" => EventNewsCustomTitle.get_trans('place'),
|
||||||
"host-head" => EventNewsCustomTitle.get_trans('host'),
|
"host-head" => EventNewsCustomTitle.get_trans('host'),
|
||||||
"notes-head" => t('event_news.notes'),
|
"notes-head" => t('event_news.notes'),
|
||||||
"event_date-head" => EventNewsCustomTitle.get_trans('event_date'),
|
"event_date-head" => EventNewsCustomTitle.get_trans('event_date'),
|
||||||
"date-head" => t('event_news.table.date'),
|
"date-head" => EventNewsCustomTitle.get_trans('event_date'),
|
||||||
"status-head" => t('event_news.table.status'),
|
"status-head" => t('event_news.table.status'),
|
||||||
"author-head" => t('event_news.table.author'),
|
"author-head" => t('event_news.table.author'),
|
||||||
"subtitle-head" => t('event_news.table.sub_title'),
|
"subtitle-head" => t('event_news.table.sub_title'),
|
||||||
|
@ -379,7 +379,7 @@ class EventNewsController < ApplicationController
|
||||||
"more_url"=>OrbitHelper.widget_more_url,
|
"more_url"=>OrbitHelper.widget_more_url,
|
||||||
"main_picture" => mp,
|
"main_picture" => mp,
|
||||||
"main_picture_description" => mpd,
|
"main_picture_description" => mpd,
|
||||||
"title-head" => t('event_news.table.title'),
|
"title-head" => t('event_news.title'),
|
||||||
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
|
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
|
||||||
"place-head" => EventNewsCustomTitle.get_trans('place'),
|
"place-head" => EventNewsCustomTitle.get_trans('place'),
|
||||||
"host-head" => EventNewsCustomTitle.get_trans('host'),
|
"host-head" => EventNewsCustomTitle.get_trans('host'),
|
||||||
|
@ -860,7 +860,7 @@ class EventNewsController < ApplicationController
|
||||||
"event_news" => event_news,
|
"event_news" => event_news,
|
||||||
"extras" => {
|
"extras" => {
|
||||||
"widget-title" =>t('event_news.event_news'),
|
"widget-title" =>t('event_news.event_news'),
|
||||||
"title-head" => t('event_news.table.title'),
|
"title-head" => t('event_news.title'),
|
||||||
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
|
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
|
||||||
"host-head" => EventNewsCustomTitle.get_trans('host'),
|
"host-head" => EventNewsCustomTitle.get_trans('host'),
|
||||||
"notes-head" => t('event_news.notes'),
|
"notes-head" => t('event_news.notes'),
|
||||||
|
|
|
@ -3,7 +3,7 @@ class EventNewsCustomTitle
|
||||||
include Mongoid::Timestamps
|
include Mongoid::Timestamps
|
||||||
field :key
|
field :key
|
||||||
field :title, type: String, localize: true
|
field :title, type: String, localize: true
|
||||||
KEYS = ['event_date','speaker','place','host']
|
KEYS = ['title','event_date','speaker','place','host']
|
||||||
def self.get_map
|
def self.get_map
|
||||||
KEYS.map do |k|
|
KEYS.map do |k|
|
||||||
s = self.where(key: k).first || self.create(key: k,title_translations: I18n.available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("event_news.#{k}")}]}.to_h)
|
s = self.where(key: k).first || self.create(key: k,title_translations: I18n.available_locales.map{|l| [l,I18n.with_locale(l){I18n.t("event_news.#{k}")}]}.to_h)
|
||||||
|
|
|
@ -2,6 +2,7 @@ en:
|
||||||
module_name:
|
module_name:
|
||||||
event_news: Event News
|
event_news: Event News
|
||||||
event_news:
|
event_news:
|
||||||
|
title: Title
|
||||||
all_day: All Day
|
all_day: All Day
|
||||||
show_today_data_first: Show today data first
|
show_today_data_first: Show today data first
|
||||||
custom_fields_title: Custom Fields Title
|
custom_fields_title: Custom Fields Title
|
||||||
|
|
|
@ -2,6 +2,7 @@ zh_tw:
|
||||||
module_name:
|
module_name:
|
||||||
event_news: 活動公告
|
event_news: 活動公告
|
||||||
event_news:
|
event_news:
|
||||||
|
title: 講題
|
||||||
all_day: 全天
|
all_day: 全天
|
||||||
show_today_data_first: 優先顯示當日資料
|
show_today_data_first: 優先顯示當日資料
|
||||||
custom_fields_title: 欄位名稱設定
|
custom_fields_title: 欄位名稱設定
|
||||||
|
|
|
@ -45,6 +45,7 @@ if bundle_update_flag
|
||||||
widget_info << copy_h
|
widget_info << copy_h
|
||||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news/_#{h["filename"]}.html.erb #{folder}modules/event_news/_#{copy_h["filename"]}.html.erb]}
|
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news/_#{h["filename"]}.html.erb #{folder}modules/event_news/_#{copy_h["filename"]}.html.erb]}
|
||||||
elsif h["force_cover"] == "true"
|
elsif h["force_cover"] == "true"
|
||||||
|
puts "Force cover: #{h["filename"]}"
|
||||||
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news/_#{h["filename"]}.html.erb #{folder}modules/event_news/_#{widget_info[widget_info_index]["filename"]}.html.erb]}
|
Bundler.with_clean_env{%x[cp -f #{app_path}/modules/event_news/_#{h["filename"]}.html.erb #{folder}modules/event_news/_#{widget_info[widget_info_index]["filename"]}.html.erb]}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -20,12 +20,12 @@
|
||||||
<span class="w-annc__status-wrap" data-list="statuses" data-level="1">
|
<span class="w-annc__status-wrap" data-list="statuses" data-level="1">
|
||||||
<span class="w-annc__status label status {{status-class}}">{{status}}</span>
|
<span class="w-annc__status label status {{status-class}}">{{status}}</span>
|
||||||
</span>
|
</span>
|
||||||
<a class="w-annc__title" href="{{link_to_show}}">【講題】{{title}}</a>
|
<a class="w-annc__title" href="{{link_to_show}}">【{{title-head}}】{{title}}</a>
|
||||||
</td>
|
</td>
|
||||||
<td class="w-annc__speaker">【講者】{{speaker}}</td>
|
<td class="w-annc__speaker">【{{speaker-head}}】{{speaker}}</td>
|
||||||
<td class="w-annc__host">{{host}}</td>
|
<td class="w-annc__host">{{host}}</td>
|
||||||
<td class="w-annc__subtitle">{{subtitle}}</td>
|
<td class="w-annc__subtitle">{{subtitle}}</td>
|
||||||
<td class="w-annc__notes">【備註】{{notes}}</td>
|
<td class="w-annc__notes">【{{notes-head}}】{{notes}}</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -280,7 +280,8 @@
|
||||||
"zh_tw" : "16. 標準表格列表-3 ( 日期, 狀態, 標題, 演講者, 主持人, 備註 )",
|
"zh_tw" : "16. 標準表格列表-3 ( 日期, 狀態, 標題, 演講者, 主持人, 備註 )",
|
||||||
"en" : "16. Standard Table List (EventDate, status, title, speaker, host, notes)"
|
"en" : "16. Standard Table List (EventDate, status, title, speaker, host, notes)"
|
||||||
},
|
},
|
||||||
"thumbnail" : "event_news_widget13_thumbs.png"
|
"thumbnail" : "event_news_widget13_thumbs.png",
|
||||||
|
"force_cover" : "true"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"filename" : "event_news_widget18",
|
"filename" : "event_news_widget18",
|
||||||
|
|
Loading…
Reference in New Issue