i10n theme names
continuous-integration/drone/pr Build is passing Details

This commit is contained in:
Dan Ballard 2021-12-15 15:17:13 -05:00
parent 8af4deaf95
commit 124694447b
19 changed files with 151 additions and 48 deletions

View File

@ -1,6 +1,19 @@
{
"@@locale": "de",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverConnectionsLabel": "Connection",

View File

@ -1,6 +1,19 @@
{
"@@locale": "en",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverConnectionsLabel": "Connection",

View File

@ -1,6 +1,19 @@
{
"@@locale": "es",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverConnectionsLabel": "Connection",

View File

@ -1,6 +1,19 @@
{
"@@locale": "fr",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverMetricsLabel": "Métriques du serveur",

View File

@ -1,6 +1,19 @@
{
"@@locale": "it",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverConnectionsLabel": "Connection",

View File

@ -1,6 +1,19 @@
{
"@@locale": "pl",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverConnectionsLabel": "Connection",

View File

@ -1,6 +1,19 @@
{
"@@locale": "pt",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverConnectionsLabel": "Connection",

View File

@ -1,6 +1,19 @@
{
"@@locale": "ru",
"@@last_modified": "2021-12-13T23:43:26+01:00",
"@@last_modified": "2021-12-15T20:46:48+01:00",
"themeColorLabel": "Color Theme",
"themeNameNeon2": "Neon2",
"themeNameNeon1": "Neon1",
"themeNameMidnight": "Midnight",
"themeNameMermaid": "Mermaid",
"themeNamePumpkin": "Pumpkin",
"themeNameGhost": "Ghost",
"themeNameVampire": "Vampire",
"themeNameWitch": "Witch",
"themeNameCwtch": "Cwtch",
"settingDownloadFolder": "Download Folder",
"settingImagePreviewsDescription": "Images will be downloaded and previewed automatically. Please note that image previews can often lead to security vulnerabilities, and you should not enable this Experiment if you use Cwtch with untrusted contacts. Profile pictures are planned for Cwtch 1.6.",
"settingImagePreviews": "Image Previews and Profile Pictures",
"experimentClickableLinksDescription": "The clickable links experiment allows you to click on URLs shared in messages",
"enableExperimentClickableLinks": "Enable Clickable Links",
"serverConnectionsLabel": "Connection",

View File

@ -5,8 +5,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final cwtch_name = "Cwtch"; // todo translate
final cwtch_theme = "cwtch";
const cwtch_theme = "cwtch";
final Color darkGreyPurple = Color(0xFF281831);
final Color deepPurple = Color(0xFF422850);
@ -45,7 +44,6 @@ class CwtchDark extends OpaqueThemeType {
static final Color settings = whiteishPurple;
static final Color accent = hotPink;
get name => cwtch_name;
get theme => cwtch_theme;
get mode => mode_dark;
@ -91,7 +89,6 @@ class CwtchLight extends OpaqueThemeType {
static final Color settings = darkPurple;
static final Color accent = hotPink;
get name => cwtch_name;
get theme => cwtch_theme;
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final ghost_theme = "ghost";
final ghost_name = "Ghost"; //Todo translate
const ghost_theme = "ghost";
OpaqueThemeType GetGhostTheme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class GhostDark extends CwtchDark {
static final Color settings = Color(0xFFFDFFFD);
static final Color accent = Color(0xFFD20070);
get name => ghost_name;
get theme => ghost_theme;
get mode => mode_dark;
@ -51,7 +49,6 @@ class GhostLight extends CwtchLight {
static final Color settings = Color(0xFF0D0D1F);
static final Color accent = Color(0xFFD20070);
get name => ghost_name;
get theme => ghost_theme;
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final mermaid_theme = "mermaid";
final mermaid_name = "Mermaid"; //Todo translate
const mermaid_theme = "mermaid";
OpaqueThemeType GetMermaidTheme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class MermaidDark extends CwtchDark {
static final Color settings = Color(0xFFF7FCFD);
static final Color accent = Color(0xFF8E64A5);
get name => mermaid_name;
get theme => mermaid_theme;
get mode => mode_dark;
@ -51,7 +49,6 @@ class MermaidLight extends CwtchLight {
static final Color settings = Color(0xFF102426);
static final Color accent = Color(0xFF8E64A5);
get name => mermaid_name;
get theme => mermaid_theme;
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final midnight_theme = "midnight";
final midnight_name = "Midnight"; //Todo translate
const midnight_theme = "midnight";
OpaqueThemeType GetMidnightTheme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class MidnightDark extends CwtchDark {
static final Color settings = Color(0xFFFFFDFF);
static final Color accent = Color(0xFFD20070);
get name => midnight_name;
get theme => midnight_theme;
get mode => mode_dark;
@ -51,7 +49,6 @@ class MidnightLight extends CwtchLight {
static final Color settings = Color(0xFF1B1B1B);
static final Color accent = Color(0xFFD20070);
get name => midnight_name;
get theme => midnight_theme;
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final neon1_theme = "neon1";
final neon1_name = "Neon1"; //Todo translate
const neon1_theme = "neon1";
OpaqueThemeType GetNeon1Theme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class Neon1Dark extends CwtchDark {
static final Color settings = Color(0xFFFFFDFF);
static final Color accent = Color(0xFFA604FE);
get name => neon1_name;
get theme => neon1_theme;
get mode => mode_dark;
@ -73,7 +71,6 @@ class Neon1Light extends CwtchLight {
static final Color settings = Color(0xFF290826);
static final Color accent = Color(0xFFA604FE);
get name => neon1_name;
get theme => neon1_theme;
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final neon2_theme = "neon2";
final neon2_name = "Neon2"; //Todo translate
const neon2_theme = "neon2";
OpaqueThemeType GetNeon2Theme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class Neon2Dark extends CwtchDark {
static final Color settings = Color(0xFFFFFDFF);
static final Color accent = Color(0xFFA604FE);
get name => neon2_name;
get theme => neon2_theme;
get mode => mode_dark;
@ -51,7 +49,6 @@ class Neon2Light extends CwtchLight {
static final Color settings = Color(0xFF290826);
static final Color accent = Color(0xFFA604FE);
get name => neon2_name;
get theme => neon2_theme;
get mode => mode_light;

View File

@ -62,7 +62,6 @@ Color darken(Color color, [double amount = 0.15]) {
abstract class OpaqueThemeType {
static final Color red = Color(0xFFFF0000);
get name => "Dummy";
get theme => "dummy";
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final pumpkin_theme = "pumpkin";
final pumpkin_name = "Pumpkin"; //Todo translate
const pumpkin_theme = "pumpkin";
OpaqueThemeType GetPumpkinTheme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class PumpkinDark extends CwtchDark {
static final Color settings = Color(0xFFFFFBF6);
static final Color accent = Color(0xFF8E64A5);
get name => pumpkin_name;
get theme => pumpkin_theme;
get mode => mode_dark;
@ -51,7 +49,6 @@ class PumpkinLight extends CwtchLight {
static final Color settings = Color(0xFF281831);
static final Color accent = Color(0xFF8E64A5);
get name => pumpkin_name;
get theme => pumpkin_theme;
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final vampire_theme = "vampire";
final vampire_name = "Vampire"; //Todo translate
const vampire_theme = "vampire";
OpaqueThemeType GetVampireTheme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class VampireDark extends CwtchDark {
static final Color settings = Color(0xFFFDFFFD);
static final Color accent = Color(0xFF8E64A5);
get name => vampire_name;
get theme => vampire_theme;
get mode => mode_dark;
@ -51,7 +49,6 @@ class VampireLight extends CwtchLight {
static final Color settings = Color(0xFF281831);
static final Color accent = Color(0xFF8E64A5);
get name => vampire_name;
get theme => vampire_theme;
get mode => mode_light;

View File

@ -6,8 +6,7 @@ import 'package:flutter/material.dart';
import 'opaque.dart';
final witch_theme = "witch";
final witch_name = "Witch"; //Todo translate
const witch_theme = "witch";
OpaqueThemeType GetWitchTheme(String mode) {
if (mode == mode_dark) {
@ -26,7 +25,6 @@ class WitchDark extends CwtchDark {
static final Color settings = Color(0xFFFDFFFD);
static final Color accent = Color(0xFFD20070);
get name => witch_name;
get theme => witch_theme;
get mode => mode_dark;
@ -51,7 +49,6 @@ class WitchLight extends CwtchLight {
static final Color settings = Color(0xFF0E1E0E);
static final Color accent = Color(0xFFD20070);
get name => witch_name;
get theme => witch_theme;
get mode => mode_light;

View File

@ -2,7 +2,16 @@ import 'dart:convert';
import 'dart:io';
import 'package:cwtch/cwtch_icons_icons.dart';
import 'package:cwtch/models/servers.dart';
import 'package:cwtch/themes/cwtch.dart';
import 'package:cwtch/themes/ghost.dart';
import 'package:cwtch/themes/mermaid.dart';
import 'package:cwtch/themes/midnight.dart';
import 'package:cwtch/themes/neon1.dart';
import 'package:cwtch/themes/neon2.dart';
import 'package:cwtch/themes/opaque.dart';
import 'package:cwtch/themes/pumpkin.dart';
import 'package:cwtch/themes/vampire.dart';
import 'package:cwtch/themes/witch.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:flutter/material.dart';
import 'package:cwtch/settings.dart';
@ -82,7 +91,7 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
secondary: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),
),
ListTile(
title: Text("Colour Theme"),
title: Text(AppLocalizations.of(context)!.themeColorLabel),
//AppLocalizations.of(context)!.settingTheme)),
trailing: DropdownButton<String>(
value: Provider.of<Settings>(context).theme.theme,
@ -95,9 +104,11 @@ class _GlobalSettingsViewState extends State<GlobalSettingsView> {
items: themes.keys.map<DropdownMenuItem<String>>((String themeId) {
return DropdownMenuItem<String>(
value: themeId,
child: Text(themes[themeId]?[mode_light]?.name ?? "Unknown"), //todo translate
child: Text(getThemeName(context, themeId)),
);
}).toList())),
}).toList()),
leading: Icon(CwtchIcons.change_theme, color: settings.current().mainTextColor),
),
ListTile(
title: Text(AppLocalizations.of(context)!.settingUIColumnPortrait, style: TextStyle(color: settings.current().mainTextColor)),
leading: Icon(Icons.table_chart, color: settings.current().mainTextColor),
@ -318,6 +329,22 @@ String getLanguageFull(context, String languageCode) {
return languageCode;
}
/// Since we don't seem to able to dynamically pull translations, this function maps themes to their names
String getThemeName(context, String theme) {
switch (theme) {
case cwtch_theme: return AppLocalizations.of(context)!.themeNameCwtch;
case ghost_theme: return AppLocalizations.of(context)!.themeNameGhost;
case mermaid_theme: return AppLocalizations.of(context)!.themeNameMermaid;
case midnight_theme: return AppLocalizations.of(context)!.themeNameMidnight;
case neon1_theme: return AppLocalizations.of(context)!.themeNameNeon1;
case neon2_theme: return AppLocalizations.of(context)!.themeNameNeon2;
case pumpkin_theme: return AppLocalizations.of(context)!.themeNamePumpkin;
case vampire_theme: return AppLocalizations.of(context)!.themeNameVampire;
case witch_theme: return AppLocalizations.of(context)!.themeNameWitch;
}
return theme;
}
/// Send an UpdateGlobalSettings to the Event Bus
saveSettings(context) {
var settings = Provider.of<Settings>(context, listen: false);