Setup: Make more strings translatable

This commit is contained in:
Vishesh Handa
2020-09-03 22:21:01 +02:00
parent 8c859d908c
commit a05e9d04de
5 changed files with 36 additions and 15 deletions

View File

@ -206,8 +206,24 @@ setup:
repoSelector:
title: Select or Create a Repository
hint: Type to Search or Create a Repo
next: Next
create: Create Repo {}
cloneUrl:
enter: Enter the Git Clone URL
validator:
empty: Please enter some text
invalid: Invalid Input
onlySsh: Only SSH urls are currently accepted
manual:
title: Please create a new git repository -
step1: 1. Go to the website, create a repo and copy its git clone URL
step2: 2. Enter the Git clone URL
button: Open Create New Repo Webpage
next: Next
fail: Failed
keyEditors:
public: Invalid Public Key - Doesn't start with ssh-rsa
private: Invalid Private Key
feature:
darkMode: Dark Mode

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:easy_localization/easy_localization.dart';
import 'package:function_types/function_types.dart';
import 'package:git_url_parse2/git_url_parse2.dart';
@ -66,7 +67,7 @@ class GitCloneUrlPageState extends State<GitCloneUrlPage> {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
"Enter the Git Clone URL",
tr("setup.cloneUrl.enter"),
style: Theme.of(context).textTheme.headline5,
),
),
@ -147,33 +148,33 @@ class GitCloneUrlKnownProviderPageState
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
'Please create a new git repository -',
tr("setup.cloneUrl.manual.title"),
style: Theme.of(context).textTheme.headline6,
),
const SizedBox(height: 32.0),
// Step 1
Text(
'1. Go to the website, create a repo and copy its git clone URL',
tr("setup.cloneUrl.manual.step1"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 8.0),
GitHostSetupButton(
text: "Open Create New Repo Webpage",
text: tr("setup.cloneUrl.manual.button"),
onPressed: widget.launchCreateUrlPage,
),
const SizedBox(height: 16.0),
// Step 2
Text(
'2. Enter the Git clone URL',
tr("setup.cloneUrl.manual.step1"),
style: Theme.of(context).textTheme.subtitle2,
),
const SizedBox(height: 8.0),
inputForm,
const SizedBox(height: 16.0),
GitHostSetupButton(
text: "Next",
text: tr("setup.next"),
onPressed: formSubmitted,
),
],
@ -185,16 +186,16 @@ class GitCloneUrlKnownProviderPageState
String _isCloneUrlValid(String url) {
url = url.trim();
if (url.isEmpty) {
return 'Please enter some text';
return tr("setup.cloneUrl.validator.empty");
}
var result = gitUrlParse(url);
if (result == null) {
return 'Invalid Input';
return tr("setup.cloneUrl.validator.invalid");
}
if (result.protocol != 'ssh') {
return 'Only SSH urls are currently accepted';
return tr("setup.cloneUrl.validator.onlySsh");
}
return null;

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
class GitHostSetupErrorPage extends StatelessWidget {
final String errorMessage;
@ -11,7 +13,7 @@ class GitHostSetupErrorPage extends StatelessWidget {
Padding(
padding: const EdgeInsets.all(8.0),
child: Text(
'Failed',
tr("setup.fail"),
textAlign: TextAlign.center,
style: Theme.of(context).textTheme.headline4,
),

View File

@ -1,5 +1,7 @@
import 'package:flutter/material.dart';
import 'package:easy_localization/easy_localization.dart';
class PublicKeyEditor extends StatelessWidget {
final Key formKey;
final TextEditingController _controller;
@ -14,7 +16,7 @@ class PublicKeyEditor extends StatelessWidget {
String _validator(String val) {
val = val.trim();
if (!val.startsWith("ssh-rsa ")) {
return "Invalid Public Key - Doesn't start with ssh-rsa";
return tr("setup.keyEditors.public");
}
return null;
}
@ -34,10 +36,10 @@ class PrivateKeyEditor extends StatelessWidget {
String _validator(String val) {
val = val.trim();
if (!val.startsWith("-----BEGIN ")) {
return "Invalid Private Key";
return tr("setup.keyEditors.private");
}
if (!val.endsWith("PRIVATE KEY-----")) {
return "Invalid Private Key";
return tr("setup.keyEditors.private");
}
return null;

View File

@ -183,7 +183,7 @@ class GitHostSetupRepoSelectorState extends State<GitHostSetupRepoSelector> {
Opacity(
opacity: canContinue ? 1.0 : 0.0,
child: GitHostSetupButton(
text: tr('setup.repoSelector.next'),
text: tr('setup.next'),
onPressed: () async {
if (selectedRepo != null) {
widget.onDone(selectedRepo);