Fix translations bug.

This commit is contained in:
BoHung Chiu 2022-01-11 11:12:37 +08:00
parent 51062fb3fe
commit e4c84edc74
7 changed files with 13 additions and 9 deletions

View File

@ -72,13 +72,13 @@ class EventNewsController < ApplicationController
"event_news" => event_news,
"extras" => {
"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'),
"place-head" => EventNewsCustomTitle.get_trans('place'),
"host-head" => EventNewsCustomTitle.get_trans('host'),
"notes-head" => t('event_news.notes'),
"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'),
"author-head" => t('event_news.table.author'),
"subtitle-head" => t('event_news.table.sub_title'),
@ -379,7 +379,7 @@ class EventNewsController < ApplicationController
"more_url"=>OrbitHelper.widget_more_url,
"main_picture" => mp,
"main_picture_description" => mpd,
"title-head" => t('event_news.table.title'),
"title-head" => t('event_news.title'),
"speaker-head" => EventNewsCustomTitle.get_trans('speaker'),
"place-head" => EventNewsCustomTitle.get_trans('place'),
"host-head" => EventNewsCustomTitle.get_trans('host'),
@ -860,7 +860,7 @@ class EventNewsController < ApplicationController
"event_news" => event_news,
"extras" => {
"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'),
"host-head" => EventNewsCustomTitle.get_trans('host'),
"notes-head" => t('event_news.notes'),

View File

@ -3,7 +3,7 @@ class EventNewsCustomTitle
include Mongoid::Timestamps
field :key
field :title, type: String, localize: true
KEYS = ['event_date','speaker','place','host']
KEYS = ['title','event_date','speaker','place','host']
def self.get_map
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)

View File

@ -2,6 +2,7 @@ en:
module_name:
event_news: Event News
event_news:
title: Title
all_day: All Day
show_today_data_first: Show today data first
custom_fields_title: Custom Fields Title

View File

@ -2,6 +2,7 @@ zh_tw:
module_name:
event_news: 活動公告
event_news:
title: 講題
all_day: 全天
show_today_data_first: 優先顯示當日資料
custom_fields_title: 欄位名稱設定

View File

@ -45,6 +45,7 @@ if bundle_update_flag
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]}
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]}
end
end

View File

@ -20,12 +20,12 @@
<span class="w-annc__status-wrap" data-list="statuses" data-level="1">
<span class="w-annc__status label status {{status-class}}">{{status}}</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 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__subtitle">{{subtitle}}</td>
<td class="w-annc__notes">【備註】{{notes}}</td>
<td class="w-annc__notes">【{{notes-head}}】{{notes}}</td>
</tr>
</tbody>
</table>

View File

@ -280,7 +280,8 @@
"zh_tw" : "16. 標準表格列表-3 ( 日期, 狀態, 標題, 演講者, 主持人, 備註 )",
"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",