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: repoSelector:
title: Select or Create a Repository title: Select or Create a Repository
hint: Type to Search or Create a Repo hint: Type to Search or Create a Repo
next: Next
create: Create Repo {} 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: feature:
darkMode: Dark Mode darkMode: Dark Mode

View File

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

View File

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

View File

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

View File

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