HostSetup: Make all remaining strings translatable

This commit is contained in:
Vishesh Handa
2020-09-04 18:46:16 +02:00
parent 12fce59fc5
commit c8e3318bb9
3 changed files with 68 additions and 39 deletions

View File

@ -242,7 +242,34 @@ setup:
keyEditors:
public: Invalid Public Key - Doesn't start with ssh-rsa
private: Invalid Private Key
sshKey:
generate: Generating SSH Key
title: In order to access this repository, this public key must be copied as a deploy key
step1: 1. Copy the key
step2a: 2. Open webpage, and paste the deploy key. Make sure it is given Write Access.
step2b: 2. Give this SSH Key access to the git repo. (You need to figure it out yourself)
step3: 3. Try Cloning ..
copy: Copy Key
copied: Public Key copied to Clipboard
regenerate: Regenerate Key
openDeploy: Open Deploy Key Webpage
clone: Clone Repo
addDeploy: Adding as a Deploy Key
sshKeyChoice:
title: We need SSH keys to authenticate -
generate: Generate new keys
custom: Provide Custom SSH Keys
sshKeyUserProvided:
public: Public Key -
private: Private Key -
cloning: Cloning ...
host:
title: Select a Git Hosting Provider -
custom: Custom
autoConfigure:
title: How do you want to do this?
automatic: Setup Automatically
manual: Let me do it manually
feature:
darkMode: Dark Mode

View File

@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:dots_indicator/dots_indicator.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:function_types/function_types.dart';
import 'package:git_bindings/git_bindings.dart';
import 'package:path/path.dart' as p;
@ -14,15 +15,15 @@ import 'package:gitjournal/analytics.dart';
import 'package:gitjournal/apis/githost_factory.dart';
import 'package:gitjournal/error_reporting.dart';
import 'package:gitjournal/settings.dart';
import 'package:gitjournal/setup/autoconfigure.dart';
import 'package:gitjournal/setup/button.dart';
import 'package:gitjournal/setup/clone_url.dart';
import 'package:gitjournal/setup/loading_error.dart';
import 'package:gitjournal/setup/repo_selector.dart';
import 'package:gitjournal/setup/sshkey.dart';
import 'package:gitjournal/state_container.dart';
import 'package:gitjournal/utils.dart';
import 'package:gitjournal/utils/logger.dart';
import 'autoconfigure.dart';
import 'button.dart';
import 'clone_url.dart';
import 'loading_error.dart';
import 'sshkey.dart';
class GitHostSetupScreen extends StatefulWidget {
final String repoFolderName;
@ -253,7 +254,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
if (pos == 4) {
if (_pageChoice[0] == PageChoice0.CustomProvider) {
return GitHostSetupLoadingErrorPage(
loadingMessage: "Cloning ...",
loadingMessage: tr('setup.cloning'),
errorMessage: gitCloneErrorMessage,
);
}
@ -303,7 +304,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
if (pos == 5) {
return GitHostSetupLoadingErrorPage(
loadingMessage: "Cloning ...",
loadingMessage: tr('setup.cloning'),
errorMessage: gitCloneErrorMessage,
);
}
@ -409,7 +410,7 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
void _copyKeyToClipboard(BuildContext context) {
Clipboard.setData(ClipboardData(text: publicKey));
showSnackbar(context, "Public Key copied to Clipboard");
showSnackbar(context, tr('setup.sshKey.copied'));
}
void _launchDeployKeyPage() async {
@ -534,12 +535,12 @@ class GitHostSetupScreenState extends State<GitHostSetupScreen> {
try {
Log.i("Generating SSH Key");
setState(() {
_autoConfigureMessage = "Generating SSH Key";
_autoConfigureMessage = tr('setup.sshKey.generate');
});
var publicKey = await generateSSHKeys(comment: "GitJournal");
Log.i("Adding as a deploy key");
_autoConfigureMessage = "Adding as a Deploy Key";
_autoConfigureMessage = tr('setup.sshKey.addDeploy');
await _gitHost.addDeployKey(publicKey, _gitHostRepo.fullName);
} on Exception catch (e, stacktrace) {
@ -622,7 +623,7 @@ class GitHostChoicePage extends StatelessWidget {
child: Column(
children: <Widget>[
Text(
"Select a Git Hosting Provider -",
tr('setup.host.title'),
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 16.0),
@ -643,7 +644,7 @@ class GitHostChoicePage extends StatelessWidget {
),
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Custom",
text: tr('setup.host.custom'),
onPressed: () async {
onCustomGitHost();
},
@ -672,19 +673,19 @@ class GitHostAutoConfigureChoicePage extends StatelessWidget {
child: Column(
children: <Widget>[
Text(
"How do you want to do this?",
tr('setup.autoConfigure.title'),
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 16.0),
GitHostSetupButton(
text: "Setup Automatically",
text: tr('setup.autoConfigure.automatic'),
onPressed: () {
onDone(GitHostSetupType.Auto);
},
),
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Let me do it manually",
text: tr('setup.autoConfigure.manual'),
onPressed: () async {
onDone(GitHostSetupType.Manual);
},

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:function_types/function_types.dart';
import 'button.dart';
@ -25,7 +26,7 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (publicKey == null || publicKey.isEmpty) {
return GitHostSetupLoadingPage("Generating SSH Key ...");
return GitHostSetupLoadingPage(tr("setup.sshKey.generate"));
}
var columns = Column(
@ -33,14 +34,14 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'In order to access this repository, this public key must be copied as a deploy key',
tr("setup.sshKey.title"),
style: Theme.of(context).textTheme.headline6,
),
const SizedBox(height: 32.0),
// Step 1
Text(
'1. Copy the key',
tr("setup.sshKey.step1"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 8.0),
@ -48,35 +49,35 @@ class GitHostSetupSshKeyKnownProvider extends StatelessWidget {
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Copy Key",
text: tr("setup.sshKey.copy"),
onPressed: () => copyKeyFunction(context),
),
GitHostSetupButton(
text: "Regenerate Key",
text: tr("setup.sshKey.regenerate"),
onPressed: regenerateFunction,
),
const SizedBox(height: 16.0),
// Step 2
Text(
'2. Open webpage, and paste the deploy key. Make sure it is given Write Access. ',
tr("setup.sshKey.step2a"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Open Deploy Key Webpage",
text: tr("setup.sshKey.openDeploy"),
onPressed: openDeployKeyPage,
),
const SizedBox(height: 16.0),
// Step 3
Text(
'3. Try Cloning ..',
tr("setup.sshKey.step3"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Clone Repo",
text: tr("setup.sshKey.clone"),
onPressed: doneFunction,
),
],
@ -106,7 +107,7 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
@override
Widget build(BuildContext context) {
if (publicKey == null || publicKey.isEmpty) {
return GitHostSetupLoadingPage("Generating SSH Key ...");
return GitHostSetupLoadingPage(tr("setup.sshKey.generate"));
}
var columns = Column(
@ -114,14 +115,14 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'In order to access this repository, this public key must be copied as a deploy key',
tr("setup.sshKey.title"),
style: Theme.of(context).textTheme.headline6,
),
const SizedBox(height: 32.0),
// Step 1
Text(
'1. Copy the key',
tr("setup.sshKey.step1"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 8.0),
@ -129,30 +130,30 @@ class GitHostSetupSshKeyUnknownProvider extends StatelessWidget {
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Copy Key",
text: tr("setup.sshKey.copy"),
onPressed: () => copyKeyFunction(context),
),
GitHostSetupButton(
text: "Regenerate Key",
text: tr("setup.sshKey.regenerate"),
onPressed: regenerateFunction,
),
const SizedBox(height: 16.0),
// Step 2
Text(
'2. Give this SSH Key access to the git repo. (You need to figure it out yourself)',
tr("setup.sshKey.step2b"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 16.0),
// Step 3
Text(
'3. Try Cloning ..',
tr("setup.sshKey.step3"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Clone Repo",
text: tr("setup.sshKey.clone"),
onPressed: doneFunction,
),
],
@ -181,17 +182,17 @@ class GitHostSetupKeyChoice extends StatelessWidget {
child: Column(
children: <Widget>[
Text(
"We need SSH keys to authenticate -",
tr("setup.sshKeyChoice.title"),
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 16.0),
GitHostSetupButton(
text: "Generate new keys",
text: tr("setup.sshKeyChoice.generate"),
onPressed: onGenerateKeys,
),
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Provide Custom SSH Keys",
text: tr("setup.sshKeyChoice.custom"),
onPressed: onUserProvidedKeys,
),
],
@ -244,21 +245,21 @@ class _GitHostUserProvidedKeysState extends State<GitHostUserProvidedKeys> {
child: Column(
children: <Widget>[
Text(
"Public Key -",
tr("setup.sshKeyUserProvided.public"),
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 8.0),
PublicKeyEditor(_publicFormKey, _publicKeyController),
const SizedBox(height: 8.0),
Text(
"Private Key -",
tr("setup.sshKeyUserProvided.private"),
style: Theme.of(context).textTheme.headline5,
),
const SizedBox(height: 8.0),
PrivateKeyEditor(_privateFormKey, _privateKeyController),
const SizedBox(height: 16.0),
GitHostSetupButton(
text: "Next",
text: tr("setup.next"),
onPressed: () {
var publicValid = _publicFormKey.currentState.validate();
var privateValid = _privateFormKey.currentState.validate();