An open-source cross-platform alternative to AirDrop
feat: extract alias generator words to i18n
Tien Do Namd29d8e6d1407
diff --git a/assets/i18n/strings.i18n.json b/assets/i18n/strings.i18n.jsonindex c0e41129..4133df17 100644--- a/assets/i18n/strings.i18n.json+++ b/assets/i18n/strings.i18n.json@@ -137,6 +137,77 @@"changelogPage": {"title": "Changelog"},+ "aliasGenerator": {+ "@info": "Different locales may have different words, it may not match 1:1",+ "adjectives": [+ "Adorable",+ "Beautiful",+ "Big",+ "Bright",+ "Clean",+ "Clever",+ "Cool",+ "Cute",+ "Cunning",+ "Determined",+ "Energetic",+ "Efficient",+ "Fantastic",+ "Fast",+ "Fine",+ "Fresh",+ "Good",+ "Gorgeous",+ "Great",+ "Handsome",+ "Hot",+ "Kind",+ "Lovely",+ "Mystic",+ "Neat",+ "Nice",+ "Patient",+ "Pretty",+ "Powerful",+ "Rich",+ "Secret",+ "Smart",+ "Solid",+ "Special",+ "Strategic",+ "Strong",+ "Tidy",+ "Wise"+ ],+ "fruits": [+ "Apple",+ "Avocado",+ "Banana",+ "Blackberry",+ "Blueberry",+ "Broccoli",+ "Carrot",+ "Cherry",+ "Coconut",+ "Grape",+ "Lemon",+ "Lettuce",+ "Mango",+ "Melon",+ "Mushroom",+ "Onion",+ "Orange",+ "Papaya",+ "Peach",+ "Pear",+ "Pineapple",+ "Potato",+ "Pumpkin",+ "Raspberry",+ "Strawberry",+ "Tomato"+ ]+ },"dialogs": {"addressInput": {"title": "Enter address",diff --git a/assets/i18n/strings_de.i18n.json b/assets/i18n/strings_de.i18n.jsonindex a0a986ea..5dfddf56 100644--- a/assets/i18n/strings_de.i18n.json+++ b/assets/i18n/strings_de.i18n.json@@ -137,6 +137,9 @@"changelogPage": {"title": "Changelog"},+ "aliasGenerator": {+ "@info": "Uses English version"+ },"dialogs": {"addressInput": {"title": "Adresse eingeben",diff --git a/lib/util/alias_generator.dart b/lib/util/alias_generator.dartindex d4da19e2..3522ed34 100644--- a/lib/util/alias_generator.dart+++ b/lib/util/alias_generator.dart@@ -1,76 +1,10 @@-import 'dart:math';+import "dart:math";-const _adj = [- 'Adorable',- 'Beautiful',- 'Big',- 'Bright',- 'Clean',- 'Clever',- 'Cool',- 'Cute',- 'Cunning',- 'Determined',- 'Energetic',- 'Efficient',- 'Fantastic',- 'Fast',- 'Fine',- 'Fresh',- 'Good',- 'Gorgeous',- 'Great',- 'Handsome',- 'Hot',- 'Kind',- 'Lovely',- 'Mystic',- 'Neat',- 'Nice',- 'Patient',- 'Pretty',- 'Powerful',- 'Rich',- 'Secret',- 'Smart',- 'Solid',- 'Special',- 'Strategic',- 'Strong',- 'Tidy',- 'Wise',-];--const _fruit = [- 'Apple',- 'Avocado',- 'Banana',- 'Blackberry',- 'Blueberry',- 'Broccoli',- 'Carrot',- 'Cherry',- 'Coconut',- 'Grape',- 'Lemon',- 'Lettuce',- 'Mango',- 'Melon',- 'Mushroom',- 'Onion',- 'Orange',- 'Papaya',- 'Peach',- 'Pear',- 'Pineapple',- 'Potato',- 'Pumpkin',- 'Raspberry',- 'Strawberry',- 'Tomato',-];+import 'package:localsend_app/gen/strings.g.dart';String generateRandomAlias() {final random = Random();- return '${_adj[random.nextInt(_adj.length)]} ${_fruit[random.nextInt(_adj.length)]}';+ final adj = t.aliasGenerator.adjectives;+ final fruits = t.aliasGenerator.fruits;+ return "${adj[random.nextInt(adj.length)]} ${fruits[random.nextInt(fruits.length)]}";}