Make all remaining strings translatable

This commit is contained in:
Vishesh Handa
2020-09-08 23:01:39 +02:00
parent 461a887514
commit 984fc6864e
13 changed files with 77 additions and 33 deletions

View File

@ -84,6 +84,7 @@ settings:
defaultFolder: Default Folder defaultFolder: Default Folder
checklistEditor: Checklist Editor checklistEditor: Checklist Editor
rawEditor: Raw Editor rawEditor: Raw Editor
choose: Choose Editor
sortingField: sortingField:
modified: Last Modified modified: Last Modified
created: Created created: Created
@ -122,7 +123,15 @@ settings:
edit: Edit edit: Edit
view: View view: View
lastUsed: Last Used lastUsed: Last Used
ssh:
syncFreq: Sync Frequency
reset: Reset Git Host
note:
title: Note Settings
defaultFolder: Default Folder for new notes
storage:
title: Storage
fileName: Filename
editors: editors:
checklist: checklist:
@ -180,6 +189,14 @@ screens:
folder_view: folder_view:
empty: Let's add some notes? empty: Let's add some notes?
OnBoarding:
skip: Skip
next: Next
getStarted: Get Started
subtitle: An Open Source Note Taking App\nbuilt on top of Git
page2: Your Notes are stored in a\nstandard Markdown + YAML\nHeader format
page3: Sync your Local Git Repo\nwith any provider
widgets: widgets:
rename: rename:
yes: Rename yes: Rename
@ -227,6 +244,17 @@ widgets:
title: Do you want to delete this note? title: Do you want to delete this note?
yes: Yes yes: Yes
no: No no: No
NoteEditor:
renameFile: Rename File
fileName: Filename
SyncButton:
error: Sync Error {}
PurchaseWidget:
failed: Purchase Failed
NoteViewer:
linkNotFound: Link '{}' not found
FolderSelectionDialog:
title: Select a Folder
rootFolder: Root Folder rootFolder: Root Folder
ignoredFiles: ignoredFiles:
@ -371,3 +399,6 @@ GitJournal operates on a "pay what you want model (with a minimum)".'
monthly: monthly:
title: Monthly Subscription title: Monthly Subscription
desc: Enables all Pro Features. After 12 months or after paying {minYearlyPurchase}, you will get all the benefits of the 'One Time Purchase' desc: Enables all Pro Features. After 12 months or after paying {minYearlyPurchase}, you will get all the benefits of the 'One Time Purchase'
thanks:
title: Thank You
subtitle: You're awesome for supporting GitJournal

View File

@ -240,8 +240,8 @@ class NoteEditorState extends State<NoteEditor> {
context: context, context: context,
builder: (_) => RenameDialog( builder: (_) => RenameDialog(
oldPath: note.filePath, oldPath: note.filePath,
inputDecoration: 'File Name', inputDecoration: tr('widgets.NoteEditor.fileName'),
dialogTitle: "Rename File", dialogTitle: tr('widgets.NoteEditor.renameFile'),
), ),
); );
if (fileName is String) { if (fileName is String) {

View File

@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:auto_size_text/auto_size_text.dart'; import 'package:auto_size_text/auto_size_text.dart';
import 'package:dots_indicator/dots_indicator.dart'; import 'package:dots_indicator/dots_indicator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:function_types/function_types.dart'; import 'package:function_types/function_types.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -45,7 +46,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
children: <Widget>[ children: <Widget>[
OnBoardingBottomButton( OnBoardingBottomButton(
key: const ValueKey("Skip"), key: const ValueKey("Skip"),
text: "Skip", text: tr("OnBoarding.Skip"),
onPressed: _finish, onPressed: _finish,
), ),
Expanded( Expanded(
@ -64,7 +65,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
), ),
OnBoardingBottomButton( OnBoardingBottomButton(
key: const ValueKey("Next"), key: const ValueKey("Next"),
text: "Next", text: tr("OnBoarding.Next"),
onPressed: _nextPage, onPressed: _nextPage,
), ),
], ],
@ -85,7 +86,7 @@ class OnBoardingScreenState extends State<OnBoardingScreen> {
child: RaisedButton( child: RaisedButton(
key: const ValueKey("GetStarted"), key: const ValueKey("GetStarted"),
child: Text( child: Text(
"Get Started", tr("OnBoarding.getStarted"),
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: Theme.of(context).textTheme.button, style: Theme.of(context).textTheme.button,
), ),
@ -179,7 +180,7 @@ class OnBoardingPage1 extends StatelessWidget {
Center(child: header), Center(child: header),
const SizedBox(height: 64.0), const SizedBox(height: 64.0),
AutoSizeText( AutoSizeText(
"A Open Source Note Taking App\nbuilt on top of Git", tr("OnBoarding.subtitle"),
style: textTheme.headline5, style: textTheme.headline5,
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 2, maxLines: 2,
@ -215,7 +216,7 @@ class OnBoardingPage2 extends StatelessWidget {
Center(child: header), Center(child: header),
const SizedBox(height: 64.0), const SizedBox(height: 64.0),
AutoSizeText( AutoSizeText(
"Your Notes are stored in a\nstandard Markdown + YAML\nHeader format", tr("OnBoarding.page2"),
style: textTheme.headline5, style: textTheme.headline5,
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 3, maxLines: 3,
@ -251,7 +252,7 @@ class OnBoardingPage3 extends StatelessWidget {
Center(child: header), Center(child: header),
const SizedBox(height: 64.0), const SizedBox(height: 64.0),
AutoSizeText( AutoSizeText(
"Sync your Local Git Repo\nwith any provider", tr("OnBoarding.page3"),
style: textTheme.headline5, style: textTheme.headline5,
textAlign: TextAlign.center, textAlign: TextAlign.center,
maxLines: 2, maxLines: 2,

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
class PurchaseThankYouScreen extends StatelessWidget { class PurchaseThankYouScreen extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -7,9 +9,9 @@ class PurchaseThankYouScreen extends StatelessWidget {
var textTheme = theme.textTheme; var textTheme = theme.textTheme;
Widget w = Column( Widget w = Column(
children: <Widget>[ children: <Widget>[
Text('Thank you', style: textTheme.headline3), Text(tr('purchase_screen.thanks.title'), style: textTheme.headline3),
Text( Text(
"You're awesome for supporting GitJournal", tr('purchase_screen.thanks.subtitle'),
style: textTheme.headline4, style: textTheme.headline4,
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),

View File

@ -44,7 +44,7 @@ class _GitRemoteSettingsScreenState extends State<GitRemoteSettingsScreen> {
var body = Column( var body = Column(
children: <Widget>[ children: <Widget>[
Text( Text(
"SSH Public Key -", tr('setup.sshKeyUserProvided.public'),
style: textTheme.bodyText1, style: textTheme.bodyText1,
textAlign: TextAlign.left, textAlign: TextAlign.left,
), ),
@ -54,18 +54,18 @@ class _GitRemoteSettingsScreenState extends State<GitRemoteSettingsScreen> {
const Divider(), const Divider(),
Builder( Builder(
builder: (BuildContext context) => Button( builder: (BuildContext context) => Button(
text: "Copy Key", text: tr('setup.sshKey.copy'),
onPressed: () => _copyKeyToClipboard(context), onPressed: () => _copyKeyToClipboard(context),
), ),
), ),
Builder( Builder(
builder: (BuildContext context) => Button( builder: (BuildContext context) => Button(
text: "Regenerate Key", text: tr('setup.sshKey.regenerate'),
onPressed: () => _generateSshKey(context), onPressed: () => _generateSshKey(context),
), ),
), ),
ListPreference( ListPreference(
title: "Sync Frequency", title: tr('settings.ssh.syncFreq'),
currentOption: settings.remoteSyncFrequency.toPublicString(), currentOption: settings.remoteSyncFrequency.toPublicString(),
options: RemoteSyncFrequency.options options: RemoteSyncFrequency.options
.map((f) => f.toPublicString()) .map((f) => f.toPublicString())
@ -78,7 +78,7 @@ class _GitRemoteSettingsScreenState extends State<GitRemoteSettingsScreen> {
}, },
), ),
RedButton( RedButton(
text: "Reset Git Host", text: tr('settings.ssh.reset'),
onPressed: () => _resetGitHost(context), onPressed: () => _resetGitHost(context),
), ),
], ],
@ -104,7 +104,7 @@ class _GitRemoteSettingsScreenState extends State<GitRemoteSettingsScreen> {
void _copyKeyToClipboard(BuildContext context) { void _copyKeyToClipboard(BuildContext context) {
Clipboard.setData(ClipboardData(text: publicKey)); Clipboard.setData(ClipboardData(text: publicKey));
showSnackbar(context, "Public Key copied to Clipboard"); showSnackbar(context, tr('setup.sshKey.copied'));
} }
void _generateSshKey(BuildContext context) { void _generateSshKey(BuildContext context) {

View File

@ -176,9 +176,9 @@ class SettingsListState extends State<SettingsList> {
}, },
), ),
), ),
SettingsHeader('Note Settings'), SettingsHeader(tr('settings.note.title')),
ListTile( ListTile(
title: const Text("Default Folder for new notes"), title: Text(tr('settings.note.defaultFolder')),
subtitle: Text(defaultNewFolder), subtitle: Text(defaultNewFolder),
onTap: () async { onTap: () async {
var destFolder = await showDialog<NotesFolderFS>( var destFolder = await showDialog<NotesFolderFS>(
@ -219,9 +219,9 @@ class SettingsListState extends State<SettingsList> {
Navigator.of(context).push(route); Navigator.of(context).push(route);
}, },
), ),
SettingsHeader("Storage"), SettingsHeader(tr('settings.storage.title')),
ListPreference( ListPreference(
title: "File Name", title: tr('settings.note.fileName'),
currentOption: settings.noteFileNameFormat.toPublicString(), currentOption: settings.noteFileNameFormat.toPublicString(),
options: options:
NoteFileNameFormat.options.map((f) => f.toPublicString()).toList(), NoteFileNameFormat.options.map((f) => f.toPublicString()).toList(),

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
class ListPreference extends StatelessWidget { class ListPreference extends StatelessWidget {
final String title; final String title;
final String currentOption; final String currentOption;
@ -44,7 +46,7 @@ class ListPreference extends StatelessWidget {
), ),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
child: const Text('CANCEL'), child: Text(tr('settings.cancel')),
onPressed: () { onPressed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
}, },

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:gitjournal/core/notes_folder_fs.dart'; import 'package:gitjournal/core/notes_folder_fs.dart';
@ -22,7 +23,7 @@ class FolderSelectionDialog extends StatelessWidget {
); );
return AlertDialog( return AlertDialog(
title: const Text('Select a Folder'), title: Text(tr('widgets.FolderSelectionDialog.title')),
content: body, content: body,
); );
} }

View File

@ -118,6 +118,7 @@ class FolderTileState extends State<FolderTile> {
) )
: null; : null;
// FIXME: Translate
var subtitle = folder.numberOfNotes.toString() + " Notes"; var subtitle = folder.numberOfNotes.toString() + " Notes";
final theme = Theme.of(context); final theme = Theme.of(context);

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:font_awesome_flutter/fa_icon.dart'; import 'package:font_awesome_flutter/fa_icon.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
@ -20,25 +21,25 @@ class NoteEditorSelector extends StatelessWidget {
_buildTile( _buildTile(
context, context,
EditorType.Markdown, EditorType.Markdown,
"Markdown Editor", tr('settings.editors.markdownEditor'),
FontAwesomeIcons.markdown, FontAwesomeIcons.markdown,
), ),
_buildTile( _buildTile(
context, context,
EditorType.Raw, EditorType.Raw,
"Raw Editor", tr('settings.editors.rawEditor'),
FontAwesomeIcons.dna, FontAwesomeIcons.dna,
), ),
_buildTile( _buildTile(
context, context,
EditorType.Checklist, EditorType.Checklist,
"Checklist Editor", tr('settings.editors.checklistEditor'),
FontAwesomeIcons.tasks, FontAwesomeIcons.tasks,
), ),
_buildTile( _buildTile(
context, context,
EditorType.Journal, EditorType.Journal,
"Journal Editor", tr('settings.editors.journalEditor'),
FontAwesomeIcons.book, FontAwesomeIcons.book,
), ),
], ],
@ -46,7 +47,7 @@ class NoteEditorSelector extends StatelessWidget {
); );
return AlertDialog( return AlertDialog(
title: const Text("Choose Editor"), title: Text(tr('settings.editors.choose')),
content: list, content: list,
); );
} }

View File

@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:cached_network_image/cached_network_image.dart'; import 'package:cached_network_image/cached_network_image.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:flutter_markdown/flutter_markdown.dart'; import 'package:flutter_markdown/flutter_markdown.dart';
import 'package:markdown/markdown.dart' as md; import 'package:markdown/markdown.dart' as md;
import 'package:path/path.dart' as p; import 'package:path/path.dart' as p;
@ -87,7 +88,10 @@ class NoteViewer extends StatelessWidget {
await launch(link); await launch(link);
} catch (e, stackTrace) { } catch (e, stackTrace) {
Log.e("Opening Link", ex: e, stacktrace: stackTrace); Log.e("Opening Link", ex: e, stacktrace: stackTrace);
showSnackbar(context, "Link '$link' not found"); showSnackbar(
context,
tr('wigets.NoteViewer.noteViewer', args: [link]),
);
} }
}, },
imageBuilder: (url, title, alt) => kDefaultImageBuilder( imageBuilder: (url, title, alt) => kDefaultImageBuilder(

View File

@ -188,7 +188,7 @@ class _PurchaseWidgetState extends State<PurchaseWidget> {
if (subStatus.isPro) { if (subStatus.isPro) {
_deliverProduct(subStatus); _deliverProduct(subStatus);
} else { } else {
_handleError("Failed to purchase product"); _handleError(tr('widgets.PurchaseWidget.failed'));
return; return;
} }
} catch (err) { } catch (err) {
@ -370,11 +370,11 @@ class PurchaseFailedDialog extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return AlertDialog( return AlertDialog(
title: const Text("Purchase Failed"), title: Text(tr('widgets.PurchaseWidget.failed')),
content: Text(text), content: Text(text),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
child: const Text("OK"), child: Text(tr('settings.ok')),
onPressed: () => Navigator.of(context).pop(), onPressed: () => Navigator.of(context).pop(),
), ),
], ],

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:badges/badges.dart'; import 'package:badges/badges.dart';
import 'package:connectivity/connectivity.dart'; import 'package:connectivity/connectivity.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:git_bindings/git_bindings.dart'; import 'package:git_bindings/git_bindings.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
@ -89,7 +90,7 @@ class _SyncButtonState extends State<SyncButton> {
final container = Provider.of<StateContainer>(context, listen: false); final 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.SyncButton.error', args: [e.cause]));
} catch (e) { } catch (e) {
showSnackbar(context, e.toString()); showSnackbar(context, e.toString());
} }