Browse Source

feat(i18n): 为模板模块添加多语言支持

将模板相关界面的硬编码字符串替换为国际化键,并在中英文翻译文件中添加对应的翻译条目。这包括模板列表、创建/编辑页面、详情页面中的按钮、标签和提示文本,以实现应用的多语言切换功能。
newdev_shunjiawei
lxm 7 months ago
parent
commit
b41cddc87b
  1. 15
      lib/core/translations/language/en_us.dart
  2. 14
      lib/core/translations/language/zh_cn.dart
  3. 15
      lib/core/translations/language/zh_hk.dart
  4. 15
      lib/core/translations/language/zh_tw.dart
  5. 2
      lib/data/services/db/sqflite_api.dart
  6. 8
      lib/modules/meeting/views/template/template_all_view.dart
  7. 16
      lib/modules/meeting/views/template/template_details_view.dart
  8. 14
      lib/modules/meeting/views/template/template_edit_view.dart
  9. 2
      lib/modules/meeting/views/template/template_view.dart

15
lib/core/translations/language/en_us.dart

@ -625,6 +625,21 @@ const Map<String, String> enUS = {
'selectSummaryTemplate': 'Select Summary Template', 'selectSummaryTemplate': 'Select Summary Template',
'useThisTemplate': 'Use This Template', 'useThisTemplate': 'Use This Template',
'lastUsed': 'Last Used', 'lastUsed': 'Last Used',
'create': 'Create',
'templateDetails': 'Template Details',
'tag': 'Tag',
'description': 'Description',
'template': 'Template',
'deleteTemplate': 'Delete Template',
'deleteTemplateConfirm': 'Are you sure you want to delete this template?',
'editTemplate': 'Edit Template',
'createTemplate': 'Create Template',
'name': 'Name',
'templateContentHint': 'Please enter template content! Tip: Click the AI button above to quickly generate template content based on the name and description you entered',
'inputNameHint': 'Please enter name',
'inputDescHint': 'Please enter description',
'custom': 'Custom',
'pleaseEnter': 'Please enter ',
'viewAll': 'View All', 'viewAll': 'View All',
'recordingLanguage': 'Recording Language', 'recordingLanguage': 'Recording Language',
'chineseSimplified': 'Chinese Mandarin (Simplified)', 'chineseSimplified': 'Chinese Mandarin (Simplified)',

14
lib/core/translations/language/zh_cn.dart

@ -578,6 +578,20 @@ const Map<String, String> zhCN = {
'selectSummaryTemplate': '选择总结模版', 'selectSummaryTemplate': '选择总结模版',
'useThisTemplate': '就用这个模版', 'useThisTemplate': '就用这个模版',
'lastUsed': '上次使用', 'lastUsed': '上次使用',
'create': '创建',
'templateDetails': '模版详情',
'tag': '标签',
'description': '描述',
'template': '模版',
'deleteTemplate': '删除模版',
'deleteTemplateConfirm': '确定要删除当前模版吗?',
'editTemplate': '编辑模版',
'createTemplate': '创建模版',
'name': '名称',
'templateContentHint': '请输入模版内容!温馨提示:点击上方AI,根据上面填写的名称和描述,可以帮助你快速生成模版内容',
'inputNameHint': '请输入名称',
'inputDescHint': '请输入描述',
'custom': '自定义',
'viewAll': '查看全部', 'viewAll': '查看全部',
'recordingLanguage': '录音语言', 'recordingLanguage': '录音语言',
'chineseSimplified': '中文普通话(简体)', 'chineseSimplified': '中文普通话(简体)',

15
lib/core/translations/language/zh_hk.dart

@ -579,6 +579,21 @@ const Map<String, String> zhHK = {
'selectSummaryTemplate': '選擇總結模板', 'selectSummaryTemplate': '選擇總結模板',
'useThisTemplate': '就用這個模板', 'useThisTemplate': '就用這個模板',
'lastUsed': '上次使用', 'lastUsed': '上次使用',
'create': '創建',
'templateDetails': '模板詳情',
'tag': '標籤',
'description': '描述',
'template': '模板',
'deleteTemplate': '刪除模板',
'deleteTemplateConfirm': '確定要刪除當前模板嗎?',
'editTemplate': '編輯模板',
'createTemplate': '創建模板',
'name': '名稱',
'templateContentHint': '請輸入模板內容!溫馨提示:點擊上方AI,根據上面填寫的名稱和描述,可以幫助你快速生成模板內容',
'inputNameHint': '請輸入名稱',
'inputDescHint': '請輸入描述',
'custom': '自訂',
'pleaseEnter': '請輸入',
'viewAll': '查看全部', 'viewAll': '查看全部',
'recordingLanguage': '錄音語言', 'recordingLanguage': '錄音語言',
'chineseSimplified': '中文普通話(簡體)', 'chineseSimplified': '中文普通話(簡體)',

15
lib/core/translations/language/zh_tw.dart

@ -579,6 +579,21 @@ const Map<String, String> zhTW = {
'selectSummaryTemplate': '選擇總結模板', 'selectSummaryTemplate': '選擇總結模板',
'useThisTemplate': '就用這個模板', 'useThisTemplate': '就用這個模板',
'lastUsed': '上次使用', 'lastUsed': '上次使用',
'create': '創建',
'templateDetails': '模板詳情',
'tag': '標籤',
'description': '描述',
'template': '模板',
'deleteTemplate': '刪除模板',
'deleteTemplateConfirm': '確定要刪除當前模板嗎?',
'editTemplate': '編輯模板',
'createTemplate': '創建模板',
'name': '名稱',
'templateContentHint': '請輸入模板內容!溫馨提示:點擊上方AI,根據上面填寫的名稱和描述,可以幫助你快速生成模板內容',
'inputNameHint': '請輸入名稱',
'inputDescHint': '請輸入描述',
'custom': '自訂',
'pleaseEnter': '請輸入',
'viewAll': '查看全部', 'viewAll': '查看全部',
'recordingLanguage': '錄音語言', 'recordingLanguage': '錄音語言',
'chineseSimplified': '中文普通話(簡體)', 'chineseSimplified': '中文普通話(簡體)',

2
lib/data/services/db/sqflite_api.dart

@ -280,7 +280,7 @@ class SqfliteApi {
categoryList.add(customCategory); categoryList.add(customCategory);
} else { } else {
categoryList.add({ categoryList.add({
'name': '自定义', 'name': 'custom'.tr,
'templates': [], 'templates': [],
}); });
} }

8
lib/modules/meeting/views/template/template_all_view.dart

@ -53,7 +53,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
Future _getTemplate() async { Future _getTemplate() async {
List list = await SqfliteApi.getMeetingTemplateList(widget.categoryid, List list = await SqfliteApi.getMeetingTemplateList(widget.categoryid,
isCustom: widget.title == '自定义'); isCustom: widget.title == 'custom'.tr); // 自定义
List templateList = []; List templateList = [];
for (var element in list) { for (var element in list) {
Map item = { Map item = {
@ -147,7 +147,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
), ),
child: Text( child: Text(
'就用这个模版', 'useThisTemplate'.tr, // 就用这个模版
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
color: _templateData.isNotEmpty color: _templateData.isNotEmpty
@ -266,7 +266,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
child: GestureDetector( child: GestureDetector(
onTap: () async { onTap: () async {
await Get.to(() => TemplateDetailsView(template, await Get.to(() => TemplateDetailsView(template,
isEdit: widget.title == '自定义')); isEdit: widget.title == 'custom'.tr)); // 自定义
if (_controller.editTemplate.isNotEmpty) { if (_controller.editTemplate.isNotEmpty) {
await _getTemplate(); await _getTemplate();
if (_controller.editTemplate['id'] == _templateData['id']) { if (_controller.editTemplate['id'] == _templateData['id']) {
@ -307,7 +307,7 @@ class _TemplateAllViewState extends State<TemplateAllView> {
), ),
), ),
child: Text( child: Text(
'上次使用', 'lastUsed'.tr, // 上次使用
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: 12.sp, fontSize: 12.sp,

16
lib/modules/meeting/views/template/template_details_view.dart

@ -54,7 +54,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
onPressed: () => Get.back(), onPressed: () => Get.back(),
), ),
title: Text( title: Text(
'模版详情', 'templateDetails'.tr, // 模版详情
style: TextStyle( style: TextStyle(
fontSize: 17.sp, fontSize: 17.sp,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -87,7 +87,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
Padding( Padding(
padding: EdgeInsets.only(top: 20.w, bottom: 5.w), padding: EdgeInsets.only(top: 20.w, bottom: 5.w),
child: Text( child: Text(
'标签', 'tag'.tr, // 标签
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -122,7 +122,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
Padding( Padding(
padding: EdgeInsets.only(top: 20.w, bottom: 5.w), padding: EdgeInsets.only(top: 20.w, bottom: 5.w),
child: Text( child: Text(
'描述', 'description'.tr, // 描述
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -140,7 +140,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
Padding( Padding(
padding: EdgeInsets.only(top: 20.w, bottom: 5.w), padding: EdgeInsets.only(top: 20.w, bottom: 5.w),
child: Text( child: Text(
'模版', 'template'.tr, // 模版
style: TextStyle( style: TextStyle(
fontSize: 12.sp, fontSize: 12.sp,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
@ -187,7 +187,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
), ),
), ),
child: Text( child: Text(
'修改', 'edit'.tr, // 编辑
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
color: isDarkMode ? Colors.white : Colors.black, color: isDarkMode ? Colors.white : Colors.black,
@ -205,13 +205,13 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
backgroundColor: backgroundColor:
isDarkMode ? Colors.grey[900] : Colors.white, isDarkMode ? Colors.grey[900] : Colors.white,
title: Text( title: Text(
'删除模版', 'deleteTemplate'.tr, // 删除模版
style: TextStyle( style: TextStyle(
color: isDarkMode ? Colors.white : Colors.black87, color: isDarkMode ? Colors.white : Colors.black87,
), ),
), ),
content: Text( content: Text(
'确定要删除当前模版吗?', 'deleteTemplateConfirm'.tr, // 确定要删除当前模版吗?
style: TextStyle( style: TextStyle(
color: isDarkMode color: isDarkMode
? Colors.grey[400] ? Colors.grey[400]
@ -266,7 +266,7 @@ class _TemplateDetailsViewState extends State<TemplateDetailsView> {
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
), ),
child: Text( child: Text(
'删除', 'delete'.tr, // 删除
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
color: Colors.white, color: Colors.white,

14
lib/modules/meeting/views/template/template_edit_view.dart

@ -81,7 +81,7 @@ class _TemplateEditViewState extends State<TemplateEditView> {
onPressed: () => Get.back(), onPressed: () => Get.back(),
), ),
title: Text( title: Text(
widget.data != null ? '编辑模版' : '创建模版', widget.data != null ? 'editTemplate'.tr : 'createTemplate'.tr, // 编辑模版/创建模版
style: TextStyle( style: TextStyle(
fontSize: 17.sp, fontSize: 17.sp,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
@ -100,15 +100,15 @@ class _TemplateEditViewState extends State<TemplateEditView> {
child: ListView( child: ListView(
padding: EdgeInsets.symmetric(horizontal: 12.w), padding: EdgeInsets.symmetric(horizontal: 12.w),
children: [ children: [
_input(isDarkMode, '名称', _nameController), _input(isDarkMode, 'name'.tr, _nameController), // 名称
_input(isDarkMode, '描述', _descController), _input(isDarkMode, 'description'.tr, _descController), // 描述
_input( _input(
isDarkMode, isDarkMode,
'模版', 'template'.tr, // 模版
_promptController, _promptController,
minLines: 8, minLines: 8,
maxLines: 100, maxLines: 100,
hintText: '请输入模版内容!温馨提示:点击上方AI,根据上面填写的名称和描述,可以帮助你快速生成模版内容', hintText: 'templateContentHint'.tr, // 请输入模版内容!温馨提示:点击上方AI,根据上面填写的名称和描述,可以帮助你快速生成模版内容
), ),
], ],
), ),
@ -135,7 +135,7 @@ class _TemplateEditViewState extends State<TemplateEditView> {
borderRadius: BorderRadius.circular(12.r), borderRadius: BorderRadius.circular(12.r),
), ),
child: Text( child: Text(
'提交', 'submit'.tr, // 提交
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
color: _nameController.text.isNotEmpty && color: _nameController.text.isNotEmpty &&
@ -225,7 +225,7 @@ class _TemplateEditViewState extends State<TemplateEditView> {
fontSize: 14.sp, fontSize: 14.sp,
), ),
decoration: InputDecoration( decoration: InputDecoration(
hintText: hintText ?? '请输入$title', hintText: hintText ?? '${'pleaseEnter'.tr}$title', // 请输入
hintStyle: TextStyle( hintStyle: TextStyle(
color: isDarkMode ? Colors.grey[500] : Colors.black54, color: isDarkMode ? Colors.grey[500] : Colors.black54,
fontSize: 14.sp, fontSize: 14.sp,

2
lib/modules/meeting/views/template/template_view.dart

@ -442,7 +442,7 @@ class _TemplateViewState extends State<TemplateView> {
Padding( Padding(
padding: EdgeInsets.symmetric(vertical: 10.w), padding: EdgeInsets.symmetric(vertical: 10.w),
child: Text( child: Text(
'创建', 'create'.tr, // 创建
style: TextStyle( style: TextStyle(
fontSize: 16.sp, fontSize: 16.sp,
color: isDarkMode ? Colors.white : Colors.black87, color: isDarkMode ? Colors.white : Colors.black87,

Loading…
Cancel
Save