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
checklistEditor: Checklist Editor
rawEditor: Raw Editor
choose: Choose Editor
sortingField:
modified: Last Modified
created: Created
@ -122,7 +123,15 @@ settings:
edit: Edit
view: View
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:
checklist:
@ -180,6 +189,14 @@ screens:
folder_view:
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:
rename:
yes: Rename
@ -227,6 +244,17 @@ widgets:
title: Do you want to delete this note?
yes: Yes
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
ignoredFiles:
@ -371,3 +399,6 @@ GitJournal operates on a "pay what you want model (with a minimum)".'
monthly:
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'
thanks:
title: Thank You
subtitle: You're awesome for supporting GitJournal

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.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:markdown/markdown.dart' as md;
import 'package:path/path.dart' as p;
@ -87,7 +88,10 @@ class NoteViewer extends StatelessWidget {
await launch(link);
} catch (e, 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(

View File

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

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:badges/badges.dart';
import 'package:connectivity/connectivity.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:git_bindings/git_bindings.dart';
import 'package:provider/provider.dart';
@ -89,7 +90,7 @@ class _SyncButtonState extends State<SyncButton> {
final container = Provider.of<StateContainer>(context, listen: false);
await container.syncNotes();
} on GitException catch (e) {
showSnackbar(context, "Sync Error: ${e.cause}");
showSnackbar(context, tr('widgets.SyncButton.error', args: [e.cause]));
} catch (e) {
showSnackbar(context, e.toString());
}