Skip to content
代码片段 群组 项目
提交 8fa27ef1 编辑于 作者: Neil Wang's avatar Neil Wang 提交者: 万友 朱
浏览文件

feat: #319 Translate words in projects

上级 fea7d8b6
No related branches found
No related tags found
无相关合并请求
显示
408 个添加34 个删除
......@@ -8,6 +8,7 @@ import 'package:jihu_gitlab_app/core/widgets/avatar_and_name.dart';
import 'package:jihu_gitlab_app/core/widgets/photo_picker.dart';
import 'package:jihu_gitlab_app/core/widgets/selector/selector.dart';
import 'package:jihu_gitlab_app/core/widgets/toast.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/todo_list/widgets/member.dart';
import 'package:jihu_gitlab_app/modules/todo_list/widgets/member_provider.dart';
......@@ -17,8 +18,8 @@ class MarkdownInputBox extends StatefulWidget {
final TextEditingController controller;
final int projectId;
static const _tabs = <String>['Write', 'Preview'];
static const _nothingToPreview = 'Nothing to preview.';
static final _tabs = <String>[S.current.markdown_write, S.current.markdown_preview];
static final _nothingToPreview = S.current.markdown_nothing_to_preview;
@override
State<MarkdownInputBox> createState() => _MarkdownInputBoxState();
......@@ -112,7 +113,7 @@ class _MarkdownInputBoxState extends State<MarkdownInputBox> with TickerProvider
style: textTheme.bodyMedium,
maxLines: null,
cursorColor: const Color(0xFFFC6D26),
decoration: const InputDecoration(hintText: 'Write a comment here...', border: InputBorder.none),
decoration: InputDecoration(hintText: S.current.markdown_placeholder, border: InputBorder.none),
);
} else {
return Markdown(
......@@ -137,7 +138,7 @@ class _MarkdownInputBoxState extends State<MarkdownInputBox> with TickerProvider
break;
default:
if (snapshot.hasError) {
Toast.show('You have picked an image failed, error: ${snapshot.error}');
Toast.show('${S.current.markdown_upload_image_error}${snapshot.error}');
}
}
return Container();
......@@ -158,7 +159,7 @@ class _MarkdownInputBoxState extends State<MarkdownInputBox> with TickerProvider
}
Future<void> _onImageButtonPressed() async {
Loader.showProgress(context, text: "Uploading ...");
Loader.showProgress(context, text: S.current.uploading);
var status = await PhotoPicker.checkAccess();
if (status) {
await PhotoPicker.pickImage();
......@@ -211,7 +212,7 @@ class _MarkdownInputBoxState extends State<MarkdownInputBox> with TickerProvider
extentOffset: index + _uploadedFileInfo!.markdown.length,
);
} else {
Toast.show('Upload file failed with error: ${FileUploader.uploadError}');
Toast.show('${S.current.markdown_upload_file_error}${FileUploader.uploadError}');
}
PhotoPicker.clearFileList();
......@@ -229,7 +230,7 @@ class _MarkdownInputBoxState extends State<MarkdownInputBox> with TickerProvider
filter: (keyword, member) => member.username.toLowerCase().contains(keyword.toLowerCase()),
dataProvider: MemberProvider(projectId: widget.projectId),
keyMapper: (member) => member.id,
title: 'Select contact',
title: S.current.contact_selector_title,
key: const Key('member-selector'),
);
})) ??
......
import 'package:flutter/material.dart';
import 'package:jihu_gitlab_app/core/widgets/common_app_bar.dart';
import 'package:jihu_gitlab_app/core/widgets/selector/data_provider.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
typedef Filter<T> = bool Function(String keyword, T t);
typedef SelectorItemBuilder<T> = Widget Function(BuildContext context, int index, T t);
......@@ -75,7 +76,7 @@ class _SelectorState<K, T> extends State<Selector<K, T>> {
onPressed: () {
Navigator.pop(context, selectedData);
},
child: Text('Done', style: TextStyle(color: Theme.of(context).primaryColor))),
child: Text(S.current.done, style: TextStyle(color: Theme.of(context).primaryColor))),
)
],
),
......@@ -108,7 +109,7 @@ class _SelectorState<K, T> extends State<Selector<K, T>> {
},
controller: _textEditingController,
decoration: InputDecoration(
hintText: 'Search',
hintText: S.current.search,
contentPadding: const EdgeInsets.symmetric(vertical: 0, horizontal: 16),
suffixIcon: IconButton(
onPressed: () {
......
......@@ -22,16 +22,40 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"assignee_selector_placeholder": MessageLookupByLibrary.simpleMessage("Select assignee(s)"),
"assignee_selector_title": MessageLookupByLibrary.simpleMessage("Select Assignees"),
"assignees": MessageLookupByLibrary.simpleMessage("Assignees"),
"contact_for_support": MessageLookupByLibrary.simpleMessage("please contact us for support"),
"contact_selector_title": MessageLookupByLibrary.simpleMessage("Select contact"),
"create": MessageLookupByLibrary.simpleMessage("Create"),
"description_selector_no_templates": MessageLookupByLibrary.simpleMessage("No templates"),
"description_selector_title": MessageLookupByLibrary.simpleMessage("Select a template"),
"done": MessageLookupByLibrary.simpleMessage("Done"),
"has_no_data": MessageLookupByLibrary.simpleMessage("No data"),
"label_selector_placeholder": MessageLookupByLibrary.simpleMessage("Select label(s)"),
"label_selector_title": MessageLookupByLibrary.simpleMessage("Select labels"),
"labels": MessageLookupByLibrary.simpleMessage("Labels"),
"load_fail": MessageLookupByLibrary.simpleMessage("Loading failed, please try again"),
"load_more": MessageLookupByLibrary.simpleMessage("Scroll up to load more..."),
"markdown_nothing_to_preview": MessageLookupByLibrary.simpleMessage("Nothing to preview."),
"markdown_placeholder": MessageLookupByLibrary.simpleMessage("Write a comment here..."),
"markdown_preview": MessageLookupByLibrary.simpleMessage("Preview"),
"markdown_upload_file_error": MessageLookupByLibrary.simpleMessage("Upload file failed with error: "),
"markdown_upload_image_error": MessageLookupByLibrary.simpleMessage("You have picked an image failed, error: "),
"markdown_write": MessageLookupByLibrary.simpleMessage("Write"),
"no_data": MessageLookupByLibrary.simpleMessage("No data"),
"no_favourite": MessageLookupByLibrary.simpleMessage("No favorites"),
"no_match": MessageLookupByLibrary.simpleMessage("No matches for "),
"projects": MessageLookupByLibrary.simpleMessage("Projects"),
"projects_children": MessageLookupByLibrary.simpleMessage("Children"),
"projects_groups": MessageLookupByLibrary.simpleMessage("Groups"),
"projects_issue_creation_create_issue": MessageLookupByLibrary.simpleMessage("Create issue"),
"projects_issue_creation_description": MessageLookupByLibrary.simpleMessage("Description"),
"projects_issue_creation_description_template": MessageLookupByLibrary.simpleMessage("Template"),
"projects_issue_creation_description_template_placeholder": MessageLookupByLibrary.simpleMessage("Choose a template"),
"projects_issue_creation_select_project": MessageLookupByLibrary.simpleMessage("Select project"),
"projects_issue_creation_title": MessageLookupByLibrary.simpleMessage("Title (required)"),
"projects_issue_creation_title_placeholder": MessageLookupByLibrary.simpleMessage("Write a issue title"),
"projects_issues": MessageLookupByLibrary.simpleMessage("Issues"),
"projects_iteration_closed": MessageLookupByLibrary.simpleMessage("Closed"),
"projects_iteration_current": MessageLookupByLibrary.simpleMessage("Open"),
......@@ -44,6 +68,7 @@ class MessageLookup extends MessageLookupByLibrary {
"resources": MessageLookupByLibrary.simpleMessage("Resources"),
"search": MessageLookupByLibrary.simpleMessage("Search"),
"todoList": MessageLookupByLibrary.simpleMessage("To-Do List"),
"uploading": MessageLookupByLibrary.simpleMessage("Uploading"),
"version_not_support": MessageLookupByLibrary.simpleMessage("Your current version is not support")
};
}
......@@ -22,28 +22,53 @@ class MessageLookup extends MessageLookupByLibrary {
final messages = _notInlinedMessages(_notInlinedMessages);
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"assignee_selector_placeholder": MessageLookupByLibrary.simpleMessage("选择指派人(可多选)"),
"assignee_selector_title": MessageLookupByLibrary.simpleMessage("选择指派人(可多选)"),
"assignees": MessageLookupByLibrary.simpleMessage("指派人"),
"contact_for_support": MessageLookupByLibrary.simpleMessage("请联系我们以获得支持"),
"contact_selector_title": MessageLookupByLibrary.simpleMessage("选择成员"),
"create": MessageLookupByLibrary.simpleMessage("创建"),
"description_selector_no_templates": MessageLookupByLibrary.simpleMessage("没有议题模板"),
"description_selector_title": MessageLookupByLibrary.simpleMessage("选择一个议题模板"),
"done": MessageLookupByLibrary.simpleMessage("完成"),
"has_no_data": MessageLookupByLibrary.simpleMessage("没有数据了"),
"label_selector_placeholder": MessageLookupByLibrary.simpleMessage("选择标记(可多选)"),
"label_selector_title": MessageLookupByLibrary.simpleMessage("选择标记"),
"labels": MessageLookupByLibrary.simpleMessage("标记"),
"load_fail": MessageLookupByLibrary.simpleMessage("加载失败,请重试"),
"load_more": MessageLookupByLibrary.simpleMessage("上拉加载更多..."),
"markdown_nothing_to_preview": MessageLookupByLibrary.simpleMessage("没有可预览的内容。"),
"markdown_placeholder": MessageLookupByLibrary.simpleMessage("写下描述"),
"markdown_preview": MessageLookupByLibrary.simpleMessage("预览"),
"markdown_upload_file_error": MessageLookupByLibrary.simpleMessage("上传文件异常:"),
"markdown_upload_image_error": MessageLookupByLibrary.simpleMessage("上传图片异常:"),
"markdown_write": MessageLookupByLibrary.simpleMessage("编辑"),
"no_data": MessageLookupByLibrary.simpleMessage("没有数据"),
"no_favourite": MessageLookupByLibrary.simpleMessage("没有星标项目"),
"no_match": MessageLookupByLibrary.simpleMessage("没有匹配到"),
"projects": MessageLookupByLibrary.simpleMessage("项目"),
"projects_children": MessageLookupByLibrary.simpleMessage("子组和项目"),
"projects_groups": MessageLookupByLibrary.simpleMessage("群组"),
"projects_issue_creation_create_issue": MessageLookupByLibrary.simpleMessage("创建议题"),
"projects_issue_creation_description": MessageLookupByLibrary.simpleMessage("描述"),
"projects_issue_creation_description_template": MessageLookupByLibrary.simpleMessage("模版"),
"projects_issue_creation_description_template_placeholder": MessageLookupByLibrary.simpleMessage("选择一个议题模版"),
"projects_issue_creation_select_project": MessageLookupByLibrary.simpleMessage("选择项目"),
"projects_issue_creation_title": MessageLookupByLibrary.simpleMessage("标题(必填)"),
"projects_issue_creation_title_placeholder": MessageLookupByLibrary.simpleMessage("填写一个议题标题"),
"projects_issues": MessageLookupByLibrary.simpleMessage("议题列表"),
"projects_iteration_closed": MessageLookupByLibrary.simpleMessage("已关闭"),
"projects_iteration_current": MessageLookupByLibrary.simpleMessage("进行中"),
"projects_iteration_item_developing": MessageLookupByLibrary.simpleMessage("迭代详情仍在开发中..."),
"projects_iteration_no_items": MessageLookupByLibrary.simpleMessage("没有迭代"),
"projects_iteration_upcoming": MessageLookupByLibrary.simpleMessage("即将到来"),
"projects_iteration_upcoming": MessageLookupByLibrary.simpleMessage("即将开始"),
"projects_iterations": MessageLookupByLibrary.simpleMessage("迭代"),
"projects_starred": MessageLookupByLibrary.simpleMessage("星标"),
"release_to_load": MessageLookupByLibrary.simpleMessage("松开加载"),
"resources": MessageLookupByLibrary.simpleMessage("资源"),
"search": MessageLookupByLibrary.simpleMessage("搜索"),
"todoList": MessageLookupByLibrary.simpleMessage("待办列表"),
"uploading": MessageLookupByLibrary.simpleMessage("上传中"),
"version_not_support": MessageLookupByLibrary.simpleMessage("您当前的版本不支持此功能")
};
}
......@@ -146,6 +146,16 @@ class S {
);
}
/// `Done`
String get done {
return Intl.message(
'Done',
name: 'done',
desc: '',
args: [],
);
}
/// `Your current version is not support`
String get version_not_support {
return Intl.message(
......@@ -166,6 +176,46 @@ class S {
);
}
/// `Create`
String get create {
return Intl.message(
'Create',
name: 'create',
desc: '',
args: [],
);
}
/// `Uploading`
String get uploading {
return Intl.message(
'Uploading',
name: 'uploading',
desc: '',
args: [],
);
}
/// `Assignees`
String get assignees {
return Intl.message(
'Assignees',
name: 'assignees',
desc: '',
args: [],
);
}
/// `Labels`
String get labels {
return Intl.message(
'Labels',
name: 'labels',
desc: '',
args: [],
);
}
/// `No favorites`
String get no_favourite {
return Intl.message(
......@@ -275,6 +325,206 @@ class S {
args: [],
);
}
/// `Select project`
String get projects_issue_creation_select_project {
return Intl.message(
'Select project',
name: 'projects_issue_creation_select_project',
desc: '',
args: [],
);
}
/// `Create issue`
String get projects_issue_creation_create_issue {
return Intl.message(
'Create issue',
name: 'projects_issue_creation_create_issue',
desc: '',
args: [],
);
}
/// `Title (required)`
String get projects_issue_creation_title {
return Intl.message(
'Title (required)',
name: 'projects_issue_creation_title',
desc: '',
args: [],
);
}
/// `Write a issue title`
String get projects_issue_creation_title_placeholder {
return Intl.message(
'Write a issue title',
name: 'projects_issue_creation_title_placeholder',
desc: '',
args: [],
);
}
/// `Template`
String get projects_issue_creation_description_template {
return Intl.message(
'Template',
name: 'projects_issue_creation_description_template',
desc: '',
args: [],
);
}
/// `Choose a template`
String get projects_issue_creation_description_template_placeholder {
return Intl.message(
'Choose a template',
name: 'projects_issue_creation_description_template_placeholder',
desc: '',
args: [],
);
}
/// `Description`
String get projects_issue_creation_description {
return Intl.message(
'Description',
name: 'projects_issue_creation_description',
desc: '',
args: [],
);
}
/// `Write`
String get markdown_write {
return Intl.message(
'Write',
name: 'markdown_write',
desc: '',
args: [],
);
}
/// `Preview`
String get markdown_preview {
return Intl.message(
'Preview',
name: 'markdown_preview',
desc: '',
args: [],
);
}
/// `Nothing to preview.`
String get markdown_nothing_to_preview {
return Intl.message(
'Nothing to preview.',
name: 'markdown_nothing_to_preview',
desc: '',
args: [],
);
}
/// `Write a comment here...`
String get markdown_placeholder {
return Intl.message(
'Write a comment here...',
name: 'markdown_placeholder',
desc: '',
args: [],
);
}
/// `You have picked an image failed, error: `
String get markdown_upload_image_error {
return Intl.message(
'You have picked an image failed, error: ',
name: 'markdown_upload_image_error',
desc: '',
args: [],
);
}
/// `Upload file failed with error: `
String get markdown_upload_file_error {
return Intl.message(
'Upload file failed with error: ',
name: 'markdown_upload_file_error',
desc: '',
args: [],
);
}
/// `Select contact`
String get contact_selector_title {
return Intl.message(
'Select contact',
name: 'contact_selector_title',
desc: '',
args: [],
);
}
/// `Select a template`
String get description_selector_title {
return Intl.message(
'Select a template',
name: 'description_selector_title',
desc: '',
args: [],
);
}
/// `No templates`
String get description_selector_no_templates {
return Intl.message(
'No templates',
name: 'description_selector_no_templates',
desc: '',
args: [],
);
}
/// `Select assignee(s)`
String get assignee_selector_placeholder {
return Intl.message(
'Select assignee(s)',
name: 'assignee_selector_placeholder',
desc: '',
args: [],
);
}
/// `Select Assignees`
String get assignee_selector_title {
return Intl.message(
'Select Assignees',
name: 'assignee_selector_title',
desc: '',
args: [],
);
}
/// `Select labels`
String get label_selector_title {
return Intl.message(
'Select labels',
name: 'label_selector_title',
desc: '',
args: [],
);
}
/// `Select label(s)`
String get label_selector_placeholder {
return Intl.message(
'Select label(s)',
name: 'label_selector_placeholder',
desc: '',
args: [],
);
}
}
class AppLocalizationDelegate extends LocalizationsDelegate<S> {
......
......@@ -9,8 +9,13 @@
"no_match": "No matches for ",
"no_data": "No data",
"search": "Search",
"done": "Done",
"version_not_support": "Your current version is not support",
"contact_for_support": "please contact us for support",
"create": "Create",
"uploading": "Uploading",
"assignees": "Assignees",
"labels": "Labels",
"no_favourite": "No favorites",
"projects_children": "Children",
"projects_issues": "Issues",
......@@ -21,5 +26,25 @@
"projects_iteration_current": "Open",
"projects_iteration_closed": "Closed",
"projects_iteration_no_items": "No iteration items",
"projects_iteration_item_developing": "The item details is in developing."
"projects_iteration_item_developing": "The item details is in developing.",
"projects_issue_creation_select_project": "Select project",
"projects_issue_creation_create_issue": "Create issue",
"projects_issue_creation_title": "Title (required)",
"projects_issue_creation_title_placeholder": "Write a issue title",
"projects_issue_creation_description_template": "Template",
"projects_issue_creation_description_template_placeholder": "Choose a template",
"projects_issue_creation_description": "Description",
"markdown_write": "Write",
"markdown_preview": "Preview",
"markdown_nothing_to_preview": "Nothing to preview.",
"markdown_placeholder": "Write a comment here...",
"markdown_upload_image_error": "You have picked an image failed, error: ",
"markdown_upload_file_error": "Upload file failed with error: ",
"contact_selector_title": "Select contact",
"description_selector_title": "Select a template",
"description_selector_no_templates": "No templates",
"assignee_selector_placeholder": "Select assignee(s)",
"assignee_selector_title": "Select Assignees",
"label_selector_title": "Select labels",
"label_selector_placeholder": "Select label(s)"
}
......@@ -9,17 +9,42 @@
"has_no_data": "没有数据了",
"no_match": "没有匹配到",
"search": "搜索",
"done": "完成",
"no_favourite": "没有星标项目",
"version_not_support": "您当前的版本不支持此功能",
"contact_for_support": "请联系我们以获得支持",
"create": "创建",
"uploading": "上传中",
"assignees": "指派人",
"labels": "标记",
"projects_children": "子组和项目",
"projects_issues": "议题列表",
"projects_iterations": "迭代",
"projects_starred": "星标",
"projects_groups": "群组",
"projects_iteration_upcoming": "即将到来",
"projects_iteration_upcoming": "即将开始",
"projects_iteration_current": "进行中",
"projects_iteration_closed": "已关闭",
"projects_iteration_no_items": "没有迭代",
"projects_iteration_item_developing": "迭代详情仍在开发中..."
"projects_iteration_item_developing": "迭代详情仍在开发中...",
"projects_issue_creation_select_project": "选择项目",
"projects_issue_creation_create_issue": "创建议题",
"projects_issue_creation_title": "标题(必填)",
"projects_issue_creation_title_placeholder": "填写一个议题标题",
"projects_issue_creation_description_template": "模版",
"projects_issue_creation_description_template_placeholder": "选择一个议题模版",
"projects_issue_creation_description": "描述",
"markdown_write": "编辑",
"markdown_preview": "预览",
"markdown_nothing_to_preview": "没有可预览的内容。",
"markdown_placeholder": "写下描述",
"markdown_upload_image_error": "上传图片异常:",
"markdown_upload_file_error": "上传文件异常:",
"contact_selector_title": "选择成员",
"description_selector_title": "选择一个议题模板",
"description_selector_no_templates": "没有议题模板",
"assignee_selector_placeholder": "选择指派人(可多选)",
"assignee_selector_title": "选择指派人(可多选)",
"label_selector_title": "选择标记",
"label_selector_placeholder": "选择标记(可多选)"
}
......@@ -4,6 +4,7 @@ import 'package:jihu_gitlab_app/core/paged_state.dart';
import 'package:jihu_gitlab_app/core/widgets/common_app_bar.dart';
import 'package:jihu_gitlab_app/core/widgets/no_data_view.dart';
import 'package:jihu_gitlab_app/core/widgets/permission_low_view.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/issues/description_selector_model.dart';
class DescriptionSelector extends StatefulWidget {
......@@ -22,7 +23,7 @@ class _DescriptionSelectorState extends PagedState<DescriptionSelector> {
@override
AppBar? buildAppBar() {
return CommonAppBar(showLeading: true, title: const Text('Select a template'));
return CommonAppBar(showLeading: true, title: Text(S.current.description_selector_title));
}
@override
......@@ -36,7 +37,7 @@ class _DescriptionSelectorState extends PagedState<DescriptionSelector> {
@override
Widget buildRefreshView() {
if (_model.loadState == LoadState.successState && _model.templates.isEmpty) {
return const NoDataView(icon: 'assets/images/no_item.png', message: 'No templates');
return NoDataView(icon: 'assets/images/no_item.png', message: S.current.description_selector_no_templates);
}
return super.buildRefreshView();
}
......
......@@ -10,6 +10,7 @@ import 'package:jihu_gitlab_app/core/widgets/input_field_with_title.dart';
import 'package:jihu_gitlab_app/core/widgets/markdown_input_box.dart';
import 'package:jihu_gitlab_app/core/widgets/toast.dart';
import 'package:jihu_gitlab_app/core/widgets/unauthorized_view.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/issues/description_selector.dart';
import 'package:jihu_gitlab_app/modules/issues/issue_creation_model.dart';
import 'package:jihu_gitlab_app/modules/issues/label.dart';
......@@ -79,7 +80,7 @@ class _IssueCreationPageState extends State<IssueCreationPage> {
},
child: Scaffold(
appBar: CommonAppBar(
title: const Text('Create issue'),
title: Text(S.current.projects_issue_creation_create_issue),
showLeading: true,
leading: BackButton(
color: Colors.black,
......@@ -115,7 +116,7 @@ class _IssueCreationPageState extends State<IssueCreationPage> {
}
});
},
child: Text('Create', style: TextStyle(color: Theme.of(context).primaryColor))),
child: Text(S.current.create, style: TextStyle(color: Theme.of(context).primaryColor))),
),
],
),
......
......@@ -25,13 +25,13 @@ class _IssueCreationViewState extends State<IssueCreationView> {
child: SingleChildScrollView(
physics: const ScrollPhysics(),
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
InputFieldWithTitle(title: 'Title (required)', placeHolder: 'Write a issue title', controller: widget.issueTitleController),
_buildTitle("Template"),
InputFieldWithTitle(title: S.current.projects_issue_creation_title, placeHolder: S.current.projects_issue_creation_title_placeholder, controller: widget.issueTitleController),
_buildTitle(S.current.projects_issue_creation_description_template),
_buildDescriptionTemplatesSelector(),
_buildDescriptionTitle("Description"),
_buildDescriptionTitle(S.current.projects_issue_creation_description),
MarkdownInputBox(projectId: widget.projectId, controller: widget.issueDescriptionController),
_buildAssigneeSelector(),
_buildTitle("Labels"),
_buildTitle(S.current.labels),
_buildSelectLabelView(),
]))),
]);
......@@ -66,7 +66,7 @@ class _IssueCreationViewState extends State<IssueCreationView> {
icon: const Icon(Icons.add, size: 22, color: Color(0xFF87878C)));
final List<Widget> children = [];
if (widget.model.selectedLabels.isEmpty) {
children.add(const Text("Select label(s)", style: TextStyle(color: Color(0XFF66696D), fontSize: 14, fontWeight: FontWeight.w400)));
children.add(Text(S.current.label_selector_placeholder, style: const TextStyle(color: Color(0XFF66696D), fontSize: 14, fontWeight: FontWeight.w400)));
} else {
for (var e in widget.model.selectedLabels) {
children.add(_buildLabelView(e));
......@@ -118,7 +118,7 @@ class _IssueCreationViewState extends State<IssueCreationView> {
selectorItemBuilder: (BuildContext context, int index, Member member) => AvatarAndName(username: member.username, avatarUrl: member.avatarUrl),
dataProviderProvider: () => MemberProvider(projectId: widget.projectId),
keyMapper: (member) => member.id,
placeHolder: "Assignees",
placeHolder: S.current.assignees,
multiSelection: () => widget.model.isMultiAssignees(),
initialData: widget.model.selectedAssignees,
filter: (keyword, e) => e.username.toUpperCase().contains(keyword.toUpperCase()));
......@@ -143,7 +143,8 @@ class _IssueCreationViewState extends State<IssueCreationView> {
},
icon: const Icon(Icons.add, size: 22, color: Color(0xFF87878C)));
final List<Widget> children = [];
children.add(Text(widget.model.templateName ?? 'Choose a template', style: const TextStyle(color: Color(0XFF66696D), fontSize: 14, fontWeight: FontWeight.w400)));
children.add(Text(widget.model.templateName ?? S.current.projects_issue_creation_description_template_placeholder,
style: const TextStyle(color: Color(0XFF66696D), fontSize: 14, fontWeight: FontWeight.w400)));
children.add(Container(transform: Matrix4.translationValues(12, 0, 0), child: iconButton));
return Container(
width: double.infinity,
......
......@@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:jihu_gitlab_app/core/paged_state.dart';
import 'package:jihu_gitlab_app/core/widgets/common_app_bar.dart';
import 'package:jihu_gitlab_app/core/widgets/no_data_view.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/issues/label_selector_model.dart';
class LabelSelector extends StatefulWidget {
......@@ -43,13 +44,13 @@ class _LabelSelectorState extends PagedState<LabelSelector> {
AppBar? buildAppBar() {
return CommonAppBar(
showLeading: true,
title: const Text('Select labels'),
title: Text(S.current.label_selector_title),
actions: [
TextButton(
onPressed: () {
Navigator.pop(context, _model.selectedLabels);
},
child: Text('Done', style: TextStyle(color: Theme.of(context).primaryColor)))
child: Text(S.current.done, style: TextStyle(color: Theme.of(context).primaryColor)))
],
);
}
......@@ -57,10 +58,7 @@ class _LabelSelectorState extends PagedState<LabelSelector> {
@override
Widget? buildListView() {
if (_model.labels.isEmpty) {
return const NoDataView(
icon: 'assets/images/no_item.png',
message: 'No items',
);
return const NoDataView();
}
return ListView.separated(
itemBuilder: (context, index) {
......
import 'package:flutter/material.dart';
import 'package:jihu_gitlab_app/core/widgets/selector/data_provider.dart';
import 'package:jihu_gitlab_app/core/widgets/selector/selector.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
typedef OnSelected<T> = void Function(List<T> data);
typedef SelectedItemBuilder<T> = Widget Function(T t);
......@@ -73,7 +74,7 @@ class _SelectableState<T> extends State<Selectable<T>> {
icon: const Icon(Icons.add, size: 22, color: Color(0xFF87878C)));
final List<Widget> children = [];
if (hasNoData) {
children.add(const Text("Select assignee(s)", style: TextStyle(color: Color(0XFF66696D), fontSize: 14, fontWeight: FontWeight.w400)));
children.add(Text(S.current.assignee_selector_placeholder, style: const TextStyle(color: Color(0XFF66696D), fontSize: 14, fontWeight: FontWeight.w400)));
} else {
for (var e in _selectedData) {
children.add(_buildSelectedItem(e));
......@@ -102,7 +103,7 @@ class _SelectableState<T> extends State<Selectable<T>> {
dataProvider: widget.dataProviderProvider(),
itemBuilder: widget.selectorItemBuilder,
filter: widget.filter,
title: "Select Assignees",
title: S.current.assignee_selector_title,
multiSelection: multiSelection,
keyMapper: widget.keyMapper,
selectedKeysProvider: () => _selectedData.map((t) => widget.keyMapper(t)).toList());
......
import 'package:flutter/material.dart';
import 'package:jihu_gitlab_app/core/paged_state.dart';
import 'package:jihu_gitlab_app/core/widgets/common_app_bar.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/issues/issue_creation_page.dart';
import 'package:jihu_gitlab_app/modules/projects/projects_selector/projects_selector_model.dart';
......@@ -19,7 +20,7 @@ class _ProjectsSelectorState extends PagedState<ProjectsSelector> {
@override
AppBar? buildAppBar() {
return CommonAppBar(showLeading: true, title: const Text('Select project'));
return CommonAppBar(showLeading: true, title: Text(S.current.projects_issue_creation_select_project));
}
@override
......
......@@ -15,5 +15,5 @@ if ! (flutter test --coverage); then
echo 'Test failed.'
exit 1
fi
lcov -r coverage/lcov.info '*/__test*__/*' --exclude lib/main.dart lib/generated/current_locale.dart lib/generated/l10n.dart lib/generated/intl/messages_all.dart lib/generated/intl/messages_en.dart lib/generated/intl/messages_zh.dart -o coverage/lcov_cleaned.info
lcov -r coverage/lcov.info '*/__test*__/*' --exclude lib/main.dart lib/generated/* lib/generated/intl/* -o coverage/lcov_cleaned.info
genhtml coverage/lcov_cleaned.info --output=coverage
......@@ -2,10 +2,14 @@ import 'package:flutter/material.dart';
import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:jihu_gitlab_app/core/widgets/markdown_input_box.dart';
import 'package:jihu_gitlab_app/generated/current_locale.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
const tabs = <String>['Write', 'Preview'];
void main() {
S.load(CurrentLocale().value);
group('Markdown Input Box', () {
testWidgets('Should display with Tab Bar', (WidgetTester tester) async {
await tester.pumpWidget(MaterialApp(
......
......@@ -26,6 +26,7 @@ import '../test_data/user.dart';
void main() {
final client = MockHttpClient();
S.load(CurrentLocale().value);
setUp(() async {
SharedPreferences.setMockInitialValues(<String, Object>{});
......
......@@ -8,6 +8,8 @@ import 'package:jihu_gitlab_app/core/token_provider.dart';
import 'package:jihu_gitlab_app/core/user_provider.dart';
import 'package:jihu_gitlab_app/core/widgets/markdown_input_box.dart';
import 'package:jihu_gitlab_app/core/widgets/unauthorized_view.dart';
import 'package:jihu_gitlab_app/generated/current_locale.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/issues/issue_creation_page.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
......@@ -28,6 +30,7 @@ void main() {
await LocalStorage.init();
await TokenProvider().restore();
await UserProvider().restore();
S.load(CurrentLocale().value);
});
testWidgets('Should view create issue page when there is no auth', (WidgetTester tester) async {
......
......@@ -8,6 +8,8 @@ import 'package:jihu_gitlab_app/core/token_provider.dart';
import 'package:jihu_gitlab_app/core/user_provider.dart';
import 'package:jihu_gitlab_app/core/widgets/avatar_and_name.dart';
import 'package:jihu_gitlab_app/core/widgets/selector/data_provider.dart';
import 'package:jihu_gitlab_app/generated/current_locale.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/issues/selectable.dart';
import 'package:jihu_gitlab_app/modules/todo_list/widgets/member.dart';
import 'package:jihu_gitlab_app/modules/todo_list/widgets/member_provider.dart';
......@@ -27,6 +29,7 @@ final client = MockHttpClient();
void main() {
late DataProvider<Member> provider;
late MockNavigatorObserver navigatorObserver;
S.load(CurrentLocale().value);
setUp(() async {
SharedPreferences.setMockInitialValues(<String, Object>{});
......
......@@ -6,6 +6,8 @@ import 'package:jihu_gitlab_app/core/net/response.dart';
import 'package:jihu_gitlab_app/core/token_provider.dart';
import 'package:jihu_gitlab_app/core/user_provider.dart';
import 'package:jihu_gitlab_app/core/widgets/unauthorized_view.dart';
import 'package:jihu_gitlab_app/generated/current_locale.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/auth/auth.dart';
import 'package:jihu_gitlab_app/modules/auth/login_page.dart';
import 'package:jihu_gitlab_app/modules/projects/projects_selector/projects_selector.dart';
......@@ -17,6 +19,8 @@ import '../../../core/net/http_request_test.mocks.dart';
import '../../../mocker/tester.dart';
void main() {
S.load(CurrentLocale().value);
testWidgets('Should preview unauthorized projects picker when do not login.', (tester) async {
await TokenProvider().restore();
await tester.pumpWidget(MultiProvider(
......
......@@ -6,6 +6,8 @@ import 'package:jihu_gitlab_app/core/net/response.dart';
import 'package:jihu_gitlab_app/core/token_provider.dart';
import 'package:jihu_gitlab_app/core/user_provider.dart';
import 'package:jihu_gitlab_app/core/widgets/loading_button.dart';
import 'package:jihu_gitlab_app/generated/current_locale.dart';
import 'package:jihu_gitlab_app/generated/l10n.dart';
import 'package:jihu_gitlab_app/modules/todo_list/todo_param.dart';
import 'package:jihu_gitlab_app/modules/todo_list/widgets/discussions_page.dart';
import 'package:mockito/mockito.dart';
......@@ -22,6 +24,8 @@ final client = MockHttpClient();
void main() {
setUp(() async {
S.load(CurrentLocale().value);
SharedPreferences.setMockInitialValues(<String, Object>{});
await LocalStorage.init();
await TokenProvider().restore();
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册