FolderView: Make strings translatable

This commit is contained in:
Vishesh Handa
2020-09-04 09:16:43 +02:00
parent ab072fc75e
commit 48e4657161
2 changed files with 40 additions and 17 deletions

View File

@ -177,6 +177,25 @@ widgets:
PurchaseButton: PurchaseButton:
text: Purchase for {price} text: Purchase for {price}
fail: Failed to Load fail: Failed to Load
FolderView:
noteSelected: Note Selected
syncError: Sync Error {}
headerOptions:
heading: Header Options
auto: Auto Generated Title
titleFileName: Title or FileName
fileName: FileName
summary: Show Summary
customize: Customize View
views:
standard: Standard View
journal: Journal View
grid: Grid View
card: Card View
select: Select View
sortingOptions: Sorting Options
viewOptions: View Options
rootFolder: Root Folder rootFolder: Root Folder
ignoredFiles: ignoredFiles:

View File

@ -77,7 +77,7 @@ class _FolderViewState extends State<FolderView> {
var title = widget.notesFolder.publicName; var title = widget.notesFolder.publicName;
if (inSelectionMode) { if (inSelectionMode) {
title = "Note Selected"; title = tr('widgets.FolderView.noteSelected');
} }
Widget folderView = Builder( Widget folderView = Builder(
@ -158,7 +158,10 @@ class _FolderViewState extends State<FolderView> {
var container = Provider.of<StateContainer>(context, listen: false); var container = Provider.of<StateContainer>(context, listen: false);
await container.syncNotes(); await container.syncNotes();
} on GitException catch (e) { } on GitException catch (e) {
showSnackbar(context, "Sync Error: ${e.cause}"); showSnackbar(
context,
tr('widgets.FolderView.syncError', args: [e.cause]),
);
} catch (e) { } catch (e) {
showSnackbar(context, e.toString()); showSnackbar(context, e.toString());
} }
@ -251,9 +254,10 @@ class _FolderViewState extends State<FolderView> {
return StatefulBuilder( return StatefulBuilder(
builder: (BuildContext context, Function setState) { builder: (BuildContext context, Function setState) {
var children = <Widget>[ var children = <Widget>[
SettingsHeader("Header Options"), SettingsHeader(tr('widgets.FolderView.headerOptions.heading')),
RadioListTile<StandardViewHeader>( RadioListTile<StandardViewHeader>(
title: const Text("Title or FileName"), title:
Text(tr('widgets.FolderView.headerOptions.titleFileName')),
value: StandardViewHeader.TitleOrFileName, value: StandardViewHeader.TitleOrFileName,
groupValue: _headerType, groupValue: _headerType,
onChanged: (newVal) { onChanged: (newVal) {
@ -262,7 +266,7 @@ class _FolderViewState extends State<FolderView> {
}, },
), ),
RadioListTile<StandardViewHeader>( RadioListTile<StandardViewHeader>(
title: const Text("Auto Generated Title"), title: Text(tr('widgets.FolderView.headerOptions.auto')),
value: StandardViewHeader.TitleGenerated, value: StandardViewHeader.TitleGenerated,
groupValue: _headerType, groupValue: _headerType,
onChanged: (newVal) { onChanged: (newVal) {
@ -271,7 +275,7 @@ class _FolderViewState extends State<FolderView> {
}, },
), ),
RadioListTile<StandardViewHeader>( RadioListTile<StandardViewHeader>(
title: const Text("FileName"), title: Text(tr('widgets.FolderView.headerOptions.fileName')),
value: StandardViewHeader.FileName, value: StandardViewHeader.FileName,
groupValue: _headerType, groupValue: _headerType,
onChanged: (newVal) { onChanged: (newVal) {
@ -280,7 +284,7 @@ class _FolderViewState extends State<FolderView> {
}, },
), ),
SwitchListTile( SwitchListTile(
title: const Text("Show Summary"), title: Text(tr('widgets.FolderView.headerOptions.summary')),
value: _showSummary, value: _showSummary,
onChanged: (bool newVal) { onChanged: (bool newVal) {
setState(() { setState(() {
@ -292,7 +296,7 @@ class _FolderViewState extends State<FolderView> {
]; ];
return AlertDialog( return AlertDialog(
title: const Text("Customize View"), title: Text(tr('widgets.FolderView.headerOptions.customize')),
content: Column( content: Column(
children: children, children: children,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -315,25 +319,25 @@ class _FolderViewState extends State<FolderView> {
builder: (BuildContext context) { builder: (BuildContext context) {
var children = <Widget>[ var children = <Widget>[
RadioListTile<FolderViewType>( RadioListTile<FolderViewType>(
title: const Text("Standard View"), title: Text(tr('widgets.FolderView.views.standard')),
value: FolderViewType.Standard, value: FolderViewType.Standard,
groupValue: _viewType, groupValue: _viewType,
onChanged: onViewChange, onChanged: onViewChange,
), ),
RadioListTile<FolderViewType>( RadioListTile<FolderViewType>(
title: const Text("Journal View"), title: Text(tr('widgets.FolderView.views.journal')),
value: FolderViewType.Journal, value: FolderViewType.Journal,
groupValue: _viewType, groupValue: _viewType,
onChanged: onViewChange, onChanged: onViewChange,
), ),
RadioListTile<FolderViewType>( RadioListTile<FolderViewType>(
title: const Text("Grid View"), title: Text(tr('widgets.FolderView.views.grid')),
value: FolderViewType.Grid, value: FolderViewType.Grid,
groupValue: _viewType, groupValue: _viewType,
onChanged: onViewChange, onChanged: onViewChange,
), ),
RadioListTile<FolderViewType>( RadioListTile<FolderViewType>(
title: const Text("Card View (Experimental)"), title: Text(tr('widgets.FolderView.views.card')),
value: FolderViewType.Card, value: FolderViewType.Card,
groupValue: _viewType, groupValue: _viewType,
onChanged: onViewChange, onChanged: onViewChange,
@ -341,7 +345,7 @@ class _FolderViewState extends State<FolderView> {
]; ];
return AlertDialog( return AlertDialog(
title: const Text("Select View"), title: Text(tr('widgets.FolderView.views.select')),
content: Column( content: Column(
children: children, children: children,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -380,14 +384,14 @@ class _FolderViewState extends State<FolderView> {
} }
}, },
itemBuilder: (BuildContext context) => <PopupMenuEntry<DropDownChoices>>[ itemBuilder: (BuildContext context) => <PopupMenuEntry<DropDownChoices>>[
const PopupMenuItem<DropDownChoices>( PopupMenuItem<DropDownChoices>(
value: DropDownChoices.SortingOptions, value: DropDownChoices.SortingOptions,
child: Text('Sorting Options'), child: Text(tr('widgets.FolderView.sortingOptions')),
), ),
if (_viewType == FolderViewType.Standard) if (_viewType == FolderViewType.Standard)
const PopupMenuItem<DropDownChoices>( PopupMenuItem<DropDownChoices>(
value: DropDownChoices.ViewOptions, value: DropDownChoices.ViewOptions,
child: Text('View Options'), child: Text(tr('widgets.FolderView.viewOptions')),
), ),
], ],
); );