@cemalidev/trate 1.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +16 -0
- package/.github/workflows/ci.yml +61 -0
- package/.github/workflows/cleanup.yml +36 -0
- package/.github/workflows/release.yml +56 -0
- package/.husky/pre-commit +4 -0
- package/.prettierrc +10 -0
- package/CHANGELOG.md +40 -0
- package/CONTRIBUTING.md +120 -0
- package/LICENSE +21 -0
- package/README.md +140 -0
- package/build.cjs +27 -0
- package/dist/index.js +1587 -0
- package/eslint.config.mjs +42 -0
- package/package.json +67 -0
- package/src/config/config.ts +130 -0
- package/src/config/types.ts +9 -0
- package/src/convert.ts +562 -0
- package/src/dashboard.ts +76 -0
- package/src/i18n/de.ts +90 -0
- package/src/i18n/en.ts +94 -0
- package/src/i18n/es.ts +90 -0
- package/src/i18n/fr.ts +90 -0
- package/src/i18n/index.ts +108 -0
- package/src/i18n/tr.ts +90 -0
- package/src/index.ts +390 -0
- package/src/logo.ts +33 -0
- package/src/types/errors.ts +38 -0
- package/src/ui.ts +40 -0
- package/src/utils/logger.ts +84 -0
- package/tests/config.test.ts +95 -0
- package/tests/i18n.test.ts +121 -0
- package/tests/validation.test.ts +149 -0
- package/tsconfig.json +18 -0
- package/vitest.config.ts +15 -0
package/src/i18n/de.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const de = {
|
|
2
|
+
app: {
|
|
3
|
+
name: 'trate',
|
|
4
|
+
tagline: 'Terminal-Währungsrechner',
|
|
5
|
+
},
|
|
6
|
+
error: {
|
|
7
|
+
noConnection: 'Überprüfen Sie Ihre Internetverbindung',
|
|
8
|
+
notFound: 'nicht gefunden',
|
|
9
|
+
invalidCurrency: 'Ungültige Währung',
|
|
10
|
+
goldPricesUnavailable: 'Goldpreise sind derzeit nicht verfügbar',
|
|
11
|
+
goldPricesLoadFailed: 'Goldpreise konnten nicht geladen werden',
|
|
12
|
+
sameCurrency: 'Gleiche Währungsumrechnung',
|
|
13
|
+
rateNotFound: 'Kurs nicht gefunden',
|
|
14
|
+
},
|
|
15
|
+
success: {
|
|
16
|
+
added: 'Hinzugefügt',
|
|
17
|
+
removed: 'Entfernt',
|
|
18
|
+
cacheCleared: 'Cache geleert',
|
|
19
|
+
settingsReset: 'Einstellungen zurückgesetzt',
|
|
20
|
+
baseCurrencySet: 'Basiswährung',
|
|
21
|
+
},
|
|
22
|
+
ui: {
|
|
23
|
+
base: 'Basis',
|
|
24
|
+
rate: 'Kurs',
|
|
25
|
+
date: 'Datum',
|
|
26
|
+
type: 'Typ',
|
|
27
|
+
symbol: 'Symbol',
|
|
28
|
+
price: 'Preis',
|
|
29
|
+
info: 'Info',
|
|
30
|
+
tip: 'Tipp',
|
|
31
|
+
noConversionNeeded: '(keine Konvertierung nötig)',
|
|
32
|
+
loading: 'lade...',
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
setBase: 'set-base',
|
|
36
|
+
list: 'list',
|
|
37
|
+
favs: 'favs',
|
|
38
|
+
add: 'add',
|
|
39
|
+
remove: 'remove',
|
|
40
|
+
help: 'help',
|
|
41
|
+
refresh: 'refresh',
|
|
42
|
+
reset: 'reset',
|
|
43
|
+
moon: 'moon',
|
|
44
|
+
setLang: 'set-lang',
|
|
45
|
+
},
|
|
46
|
+
dashboard: {
|
|
47
|
+
title: 'Favoriten-Dashboard',
|
|
48
|
+
favorites: 'Favoriten',
|
|
49
|
+
usage: 'Für Schnellkurs verwenden',
|
|
50
|
+
usageAdd: 'Zum Hinzufügen von Favoriten',
|
|
51
|
+
type: {
|
|
52
|
+
fiat: 'FIAT',
|
|
53
|
+
crypto: 'Krypto',
|
|
54
|
+
metal: 'METALL',
|
|
55
|
+
gold: 'GOLD',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
help: {
|
|
59
|
+
usage: 'Verwendung',
|
|
60
|
+
examples: 'Beispiele',
|
|
61
|
+
crypto: 'Krypto',
|
|
62
|
+
metals: 'Metalle',
|
|
63
|
+
jewelry: 'Schmuck',
|
|
64
|
+
config: 'Konfiguration',
|
|
65
|
+
alias: 'Benutzerdefinierte Aliase',
|
|
66
|
+
aliasCreate: 'Shortcut erstellen',
|
|
67
|
+
aliasView: 'Aliase anzeigen',
|
|
68
|
+
},
|
|
69
|
+
moon: {
|
|
70
|
+
toTheMoon: 'Zum Mond!',
|
|
71
|
+
goingToMoon: 'WIR FLIEGEN ZUM MOND!',
|
|
72
|
+
tip: 'Für aktuelle Preise verwenden',
|
|
73
|
+
},
|
|
74
|
+
display: {
|
|
75
|
+
goldOunce: 'Gold Unze',
|
|
76
|
+
goldKg: 'Gramm Gold',
|
|
77
|
+
silverKg: 'Silber Kg',
|
|
78
|
+
silverOunce: 'Silber Unze',
|
|
79
|
+
quarterGold: 'Viertel Gold',
|
|
80
|
+
halfGold: 'Halbes Gold',
|
|
81
|
+
fullGold: 'Volles Gold',
|
|
82
|
+
ataGold: 'Ata Gold',
|
|
83
|
+
gremseGold: 'Gremse Gold',
|
|
84
|
+
},
|
|
85
|
+
cli: {
|
|
86
|
+
specifyCurrency: 'Geben Sie eine Währung an',
|
|
87
|
+
usage: 'Verwendung',
|
|
88
|
+
invalidCommand: 'Ungültiger Befehl',
|
|
89
|
+
},
|
|
90
|
+
};
|
package/src/i18n/en.ts
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
app: {
|
|
3
|
+
name: 'trate',
|
|
4
|
+
tagline: 'Terminal exchange rate tracker',
|
|
5
|
+
},
|
|
6
|
+
error: {
|
|
7
|
+
noConnection: 'Check your internet connection',
|
|
8
|
+
notFound: 'not found',
|
|
9
|
+
invalidCurrency: 'Invalid currency',
|
|
10
|
+
goldPricesUnavailable: 'Gold prices are currently unavailable',
|
|
11
|
+
goldPricesLoadFailed: 'Failed to load gold prices',
|
|
12
|
+
sameCurrency: 'Same currency conversion',
|
|
13
|
+
rateNotFound: 'rate not found',
|
|
14
|
+
},
|
|
15
|
+
success: {
|
|
16
|
+
added: 'Added',
|
|
17
|
+
removed: 'Removed',
|
|
18
|
+
cacheCleared: 'Cache cleared',
|
|
19
|
+
settingsReset: 'Settings reset',
|
|
20
|
+
baseCurrencySet: 'Base currency',
|
|
21
|
+
},
|
|
22
|
+
ui: {
|
|
23
|
+
base: 'Base',
|
|
24
|
+
rate: 'Rate',
|
|
25
|
+
date: 'Date',
|
|
26
|
+
type: 'Type',
|
|
27
|
+
symbol: 'Symbol',
|
|
28
|
+
price: 'Price',
|
|
29
|
+
info: 'Info',
|
|
30
|
+
tip: 'Tip',
|
|
31
|
+
noConversionNeeded: '(no conversion needed)',
|
|
32
|
+
loading: 'loading...',
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
setBase: 'set-base',
|
|
36
|
+
list: 'list',
|
|
37
|
+
favs: 'favs',
|
|
38
|
+
add: 'add',
|
|
39
|
+
remove: 'remove',
|
|
40
|
+
help: 'help',
|
|
41
|
+
refresh: 'refresh',
|
|
42
|
+
reset: 'reset',
|
|
43
|
+
moon: 'moon',
|
|
44
|
+
setLang: 'set-lang',
|
|
45
|
+
alias: 'alias',
|
|
46
|
+
aliasAdd: 'alias add',
|
|
47
|
+
aliasRemove: 'alias remove',
|
|
48
|
+
aliasList: 'alias list',
|
|
49
|
+
},
|
|
50
|
+
dashboard: {
|
|
51
|
+
title: 'Favorites Dashboard',
|
|
52
|
+
favorites: 'Favorites',
|
|
53
|
+
usage: 'Use for quick rate',
|
|
54
|
+
usageAdd: 'Use to add favorites',
|
|
55
|
+
type: {
|
|
56
|
+
fiat: 'FIAT',
|
|
57
|
+
crypto: 'CRYPTO',
|
|
58
|
+
metal: 'METAL',
|
|
59
|
+
gold: 'GOLD',
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
help: {
|
|
63
|
+
usage: 'Usage',
|
|
64
|
+
examples: 'Examples',
|
|
65
|
+
crypto: 'Crypto',
|
|
66
|
+
metals: 'Metals',
|
|
67
|
+
jewelry: 'Jewelry',
|
|
68
|
+
config: 'Config',
|
|
69
|
+
alias: 'Custom Aliases',
|
|
70
|
+
aliasCreate: 'Create shortcut',
|
|
71
|
+
aliasView: 'View aliases',
|
|
72
|
+
},
|
|
73
|
+
moon: {
|
|
74
|
+
toTheMoon: 'To The Moon!',
|
|
75
|
+
goingToMoon: 'WE ARE GOING TO THE MOON!',
|
|
76
|
+
tip: 'Use for current prices',
|
|
77
|
+
},
|
|
78
|
+
display: {
|
|
79
|
+
goldOunce: 'Gold Ounce',
|
|
80
|
+
goldKg: 'Gram Gold',
|
|
81
|
+
silverKg: 'Silver Kg',
|
|
82
|
+
silverOunce: 'Silver Ounce',
|
|
83
|
+
quarterGold: 'Quarter Gold',
|
|
84
|
+
halfGold: 'Half Gold',
|
|
85
|
+
fullGold: 'Full Gold',
|
|
86
|
+
ataGold: 'Ata Gold',
|
|
87
|
+
gremseGold: 'Gremse Gold',
|
|
88
|
+
},
|
|
89
|
+
cli: {
|
|
90
|
+
specifyCurrency: 'Specify a currency',
|
|
91
|
+
usage: 'Usage',
|
|
92
|
+
invalidCommand: 'Invalid command',
|
|
93
|
+
},
|
|
94
|
+
};
|
package/src/i18n/es.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const es = {
|
|
2
|
+
app: {
|
|
3
|
+
name: 'trate',
|
|
4
|
+
tagline: 'Rastreador de tipos de cambio para terminal',
|
|
5
|
+
},
|
|
6
|
+
error: {
|
|
7
|
+
noConnection: 'Verifica tu conexión a internet',
|
|
8
|
+
notFound: 'no encontrado',
|
|
9
|
+
invalidCurrency: 'Moneda inválida',
|
|
10
|
+
goldPricesUnavailable: 'Los precios del oro no están disponibles actualmente',
|
|
11
|
+
goldPricesLoadFailed: 'Error al cargar los precios del oro',
|
|
12
|
+
sameCurrency: 'Conversión de la misma moneda',
|
|
13
|
+
rateNotFound: 'tipo de cambio no encontrado',
|
|
14
|
+
},
|
|
15
|
+
success: {
|
|
16
|
+
added: 'Añadido',
|
|
17
|
+
removed: 'Eliminado',
|
|
18
|
+
cacheCleared: 'Caché limpiado',
|
|
19
|
+
settingsReset: 'Configuración reiniciada',
|
|
20
|
+
baseCurrencySet: 'Moneda base',
|
|
21
|
+
},
|
|
22
|
+
ui: {
|
|
23
|
+
base: 'Base',
|
|
24
|
+
rate: 'Tipo',
|
|
25
|
+
date: 'Fecha',
|
|
26
|
+
type: 'Tipo',
|
|
27
|
+
symbol: 'Símbolo',
|
|
28
|
+
price: 'Precio',
|
|
29
|
+
info: 'Info',
|
|
30
|
+
tip: 'Consejo',
|
|
31
|
+
noConversionNeeded: '(sin conversión necesaria)',
|
|
32
|
+
loading: 'cargando...',
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
setBase: 'set-base',
|
|
36
|
+
list: 'list',
|
|
37
|
+
favs: 'favs',
|
|
38
|
+
add: 'add',
|
|
39
|
+
remove: 'remove',
|
|
40
|
+
help: 'help',
|
|
41
|
+
refresh: 'refresh',
|
|
42
|
+
reset: 'reset',
|
|
43
|
+
moon: 'moon',
|
|
44
|
+
setLang: 'set-lang',
|
|
45
|
+
},
|
|
46
|
+
dashboard: {
|
|
47
|
+
title: 'Panel de favoritos',
|
|
48
|
+
favorites: 'Favoritos',
|
|
49
|
+
usage: 'Usar para tipo rápido',
|
|
50
|
+
usageAdd: 'Usar para añadir favoritos',
|
|
51
|
+
type: {
|
|
52
|
+
fiat: 'FIAT',
|
|
53
|
+
crypto: 'CRIPTO',
|
|
54
|
+
metal: 'METALES',
|
|
55
|
+
gold: 'ORO',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
help: {
|
|
59
|
+
usage: 'Uso',
|
|
60
|
+
examples: 'Ejemplos',
|
|
61
|
+
crypto: 'Cripto',
|
|
62
|
+
metals: 'Metales',
|
|
63
|
+
jewelry: 'Joyería',
|
|
64
|
+
config: 'Config',
|
|
65
|
+
alias: 'Alias Personalizados',
|
|
66
|
+
aliasCreate: 'Crear atajo',
|
|
67
|
+
aliasView: 'Ver aliases',
|
|
68
|
+
},
|
|
69
|
+
moon: {
|
|
70
|
+
toTheMoon: '¡A la Luna!',
|
|
71
|
+
goingToMoon: '¡VAMOS A LA LUNA!',
|
|
72
|
+
tip: 'Usar para precios actuales',
|
|
73
|
+
},
|
|
74
|
+
display: {
|
|
75
|
+
goldOunce: 'Onza de oro',
|
|
76
|
+
goldKg: 'Oro Gramo',
|
|
77
|
+
silverKg: 'Plata Kg',
|
|
78
|
+
silverOunce: 'Onza de plata',
|
|
79
|
+
quarterGold: 'Cuarto de oro',
|
|
80
|
+
halfGold: 'Medio oro',
|
|
81
|
+
fullGold: 'Oro entero',
|
|
82
|
+
ataGold: 'Oro Ata',
|
|
83
|
+
gremseGold: 'Oro Gremse',
|
|
84
|
+
},
|
|
85
|
+
cli: {
|
|
86
|
+
specifyCurrency: 'Especifica una moneda',
|
|
87
|
+
usage: 'Uso',
|
|
88
|
+
invalidCommand: 'Comando inválido',
|
|
89
|
+
},
|
|
90
|
+
};
|
package/src/i18n/fr.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const fr = {
|
|
2
|
+
app: {
|
|
3
|
+
name: 'trate',
|
|
4
|
+
tagline: 'Suivi des taux de change pour terminal',
|
|
5
|
+
},
|
|
6
|
+
error: {
|
|
7
|
+
noConnection: 'Vérifiez votre connexion internet',
|
|
8
|
+
notFound: 'non trouvé',
|
|
9
|
+
invalidCurrency: 'Devise invalide',
|
|
10
|
+
goldPricesUnavailable: "Les prix de l'or ne sont actuellement pas disponibles",
|
|
11
|
+
goldPricesLoadFailed: "Échec du chargement des prix de l'or",
|
|
12
|
+
sameCurrency: 'Conversion de même devise',
|
|
13
|
+
rateNotFound: 'taux non trouvé',
|
|
14
|
+
},
|
|
15
|
+
success: {
|
|
16
|
+
added: 'Ajouté',
|
|
17
|
+
removed: 'Supprimé',
|
|
18
|
+
cacheCleared: 'Cache vidé',
|
|
19
|
+
settingsReset: 'Paramètres réinitialisés',
|
|
20
|
+
baseCurrencySet: 'Devise de base',
|
|
21
|
+
},
|
|
22
|
+
ui: {
|
|
23
|
+
base: 'Base',
|
|
24
|
+
rate: 'Taux',
|
|
25
|
+
date: 'Date',
|
|
26
|
+
type: 'Type',
|
|
27
|
+
symbol: 'Symbole',
|
|
28
|
+
price: 'Prix',
|
|
29
|
+
info: 'Info',
|
|
30
|
+
tip: 'Astuce',
|
|
31
|
+
noConversionNeeded: '(pas de conversion nécessaire)',
|
|
32
|
+
loading: 'chargement...',
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
setBase: 'set-base',
|
|
36
|
+
list: 'list',
|
|
37
|
+
favs: 'favs',
|
|
38
|
+
add: 'add',
|
|
39
|
+
remove: 'remove',
|
|
40
|
+
help: 'help',
|
|
41
|
+
refresh: 'refresh',
|
|
42
|
+
reset: 'reset',
|
|
43
|
+
moon: 'moon',
|
|
44
|
+
setLang: 'set-lang',
|
|
45
|
+
},
|
|
46
|
+
dashboard: {
|
|
47
|
+
title: 'Tableau de bord des favoris',
|
|
48
|
+
favorites: 'Favoris',
|
|
49
|
+
usage: 'Utiliser pour le taux rapide',
|
|
50
|
+
usageAdd: 'Utiliser pour ajouter des favoris',
|
|
51
|
+
type: {
|
|
52
|
+
fiat: 'FIAT',
|
|
53
|
+
crypto: 'CRYPTO',
|
|
54
|
+
metal: 'MÉTAUX',
|
|
55
|
+
gold: 'OR',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
help: {
|
|
59
|
+
usage: 'Utilisation',
|
|
60
|
+
examples: 'Exemples',
|
|
61
|
+
crypto: 'Crypto',
|
|
62
|
+
metals: 'Métaux',
|
|
63
|
+
jewelry: 'Bijouterie',
|
|
64
|
+
config: 'Configuration',
|
|
65
|
+
alias: 'Alias Personnalisés',
|
|
66
|
+
aliasCreate: 'Créer raccourci',
|
|
67
|
+
aliasView: 'Voir alias',
|
|
68
|
+
},
|
|
69
|
+
moon: {
|
|
70
|
+
toTheMoon: 'Vers la Lune!',
|
|
71
|
+
goingToMoon: 'NOUS ALLONS VERS LA LUNE!',
|
|
72
|
+
tip: 'Utiliser pour les prix actuels',
|
|
73
|
+
},
|
|
74
|
+
display: {
|
|
75
|
+
goldOunce: "Once d'or",
|
|
76
|
+
goldKg: 'Or Gramme',
|
|
77
|
+
silverKg: 'Argent Kg',
|
|
78
|
+
silverOunce: "Once d'argent",
|
|
79
|
+
quarterGold: "Quart d'or",
|
|
80
|
+
halfGold: 'Demi-or',
|
|
81
|
+
fullGold: 'Or entier',
|
|
82
|
+
ataGold: 'Or Ata',
|
|
83
|
+
gremseGold: 'Or Gremse',
|
|
84
|
+
},
|
|
85
|
+
cli: {
|
|
86
|
+
specifyCurrency: 'Spécifiez une devise',
|
|
87
|
+
usage: 'Utilisation',
|
|
88
|
+
invalidCommand: 'Commande invalide',
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { tr } from './tr';
|
|
2
|
+
import { en } from './en';
|
|
3
|
+
import { de } from './de';
|
|
4
|
+
import { fr } from './fr';
|
|
5
|
+
import { es } from './es';
|
|
6
|
+
|
|
7
|
+
export type Locale = 'tr' | 'en' | 'de' | 'fr' | 'es';
|
|
8
|
+
|
|
9
|
+
export type Translations = typeof tr;
|
|
10
|
+
|
|
11
|
+
const translations: Record<Locale, Translations> = {
|
|
12
|
+
tr,
|
|
13
|
+
en,
|
|
14
|
+
de,
|
|
15
|
+
fr,
|
|
16
|
+
es,
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const supportedLocales: Locale[] = ['tr', 'en', 'de', 'fr', 'es'];
|
|
20
|
+
|
|
21
|
+
function getSystemLocale(): Locale {
|
|
22
|
+
const systemLocale = Intl.DateTimeFormat().resolvedOptions().locale;
|
|
23
|
+
const languageCode = systemLocale.split('-')[0].toLowerCase();
|
|
24
|
+
|
|
25
|
+
if (supportedLocales.includes(languageCode as Locale)) {
|
|
26
|
+
return languageCode as Locale;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return 'en';
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let currentLocale: Locale | null = null;
|
|
33
|
+
|
|
34
|
+
export function getLocale(): Locale {
|
|
35
|
+
if (currentLocale) {
|
|
36
|
+
return currentLocale;
|
|
37
|
+
}
|
|
38
|
+
return getSystemLocale();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { getSystemLocale };
|
|
42
|
+
|
|
43
|
+
export function setLocale(locale: Locale): void {
|
|
44
|
+
if (!supportedLocales.includes(locale)) {
|
|
45
|
+
throw new Error(`Unsupported locale: ${locale}. Supported: ${supportedLocales.join(', ')}`);
|
|
46
|
+
}
|
|
47
|
+
currentLocale = locale;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function resetLocale(): void {
|
|
51
|
+
currentLocale = null;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export function getSupportedLocales(): Locale[] {
|
|
55
|
+
return [...supportedLocales];
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function getLocaleDisplayName(locale: Locale): string {
|
|
59
|
+
const displayNames: Record<Locale, string> = {
|
|
60
|
+
tr: 'Türkçe',
|
|
61
|
+
en: 'English',
|
|
62
|
+
de: 'Deutsch',
|
|
63
|
+
fr: 'Français',
|
|
64
|
+
es: 'Español',
|
|
65
|
+
};
|
|
66
|
+
return displayNames[locale];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
type NestedKeyOf<T> = T extends object
|
|
70
|
+
? {
|
|
71
|
+
[K in keyof T]: K extends string
|
|
72
|
+
? T[K] extends object
|
|
73
|
+
? `${K}.${NestedKeyOf<T[K]>}`
|
|
74
|
+
: K
|
|
75
|
+
: never;
|
|
76
|
+
}[keyof T]
|
|
77
|
+
: never;
|
|
78
|
+
|
|
79
|
+
type TranslationKey = NestedKeyOf<Translations>;
|
|
80
|
+
|
|
81
|
+
function getNestedValue(obj: unknown, path: string): string {
|
|
82
|
+
const keys = path.split('.');
|
|
83
|
+
let value: unknown = obj;
|
|
84
|
+
|
|
85
|
+
for (const key of keys) {
|
|
86
|
+
if (value && typeof value === 'object' && key in value) {
|
|
87
|
+
value = (value as Record<string, unknown>)[key];
|
|
88
|
+
} else {
|
|
89
|
+
return path;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return typeof value === 'string' ? value : path;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function t(key: TranslationKey): string {
|
|
97
|
+
const locale = getLocale();
|
|
98
|
+
const translation = translations[locale];
|
|
99
|
+
const value = getNestedValue(translation, key);
|
|
100
|
+
|
|
101
|
+
if (value === key && locale !== 'en') {
|
|
102
|
+
return getNestedValue(translations.en, key);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
return value;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export { tr, en, de, fr, es };
|
package/src/i18n/tr.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
export const tr = {
|
|
2
|
+
app: {
|
|
3
|
+
name: 'trate',
|
|
4
|
+
tagline: 'Terminal döviz kuru takipçisi',
|
|
5
|
+
},
|
|
6
|
+
error: {
|
|
7
|
+
noConnection: 'İnternet bağlantınızı kontrol ediniz',
|
|
8
|
+
notFound: 'bulunamadı',
|
|
9
|
+
invalidCurrency: 'Geçersiz para birimi',
|
|
10
|
+
goldPricesUnavailable: 'Altın fiyatları şu anda mevcut değil',
|
|
11
|
+
goldPricesLoadFailed: 'Altın fiyatları yüklenemedi',
|
|
12
|
+
sameCurrency: 'Aynı para birimi dönüşümü',
|
|
13
|
+
rateNotFound: 'kuru bulunamadı',
|
|
14
|
+
},
|
|
15
|
+
success: {
|
|
16
|
+
added: 'Eklendi',
|
|
17
|
+
removed: 'Çıkarıldı',
|
|
18
|
+
cacheCleared: 'Cache temizlendi',
|
|
19
|
+
settingsReset: 'Ayarlar sıfırlandı',
|
|
20
|
+
baseCurrencySet: 'Base para birimi',
|
|
21
|
+
},
|
|
22
|
+
ui: {
|
|
23
|
+
base: 'Base',
|
|
24
|
+
rate: 'Kur',
|
|
25
|
+
date: 'Tarih',
|
|
26
|
+
type: 'Tip',
|
|
27
|
+
symbol: 'Sembol',
|
|
28
|
+
price: 'Fiyat',
|
|
29
|
+
info: 'Info',
|
|
30
|
+
tip: 'İpucu',
|
|
31
|
+
noConversionNeeded: '(dönüşüme gerek yok)',
|
|
32
|
+
loading: 'loading...',
|
|
33
|
+
},
|
|
34
|
+
commands: {
|
|
35
|
+
setBase: 'set-base',
|
|
36
|
+
list: 'list',
|
|
37
|
+
favs: 'favs',
|
|
38
|
+
add: 'add',
|
|
39
|
+
remove: 'remove',
|
|
40
|
+
help: 'help',
|
|
41
|
+
refresh: 'refresh',
|
|
42
|
+
reset: 'reset',
|
|
43
|
+
moon: 'moon',
|
|
44
|
+
setLang: 'set-lang',
|
|
45
|
+
},
|
|
46
|
+
dashboard: {
|
|
47
|
+
title: 'Favoriler Panosu',
|
|
48
|
+
favorites: 'Favoriler',
|
|
49
|
+
usage: 'Hızlı kur için',
|
|
50
|
+
usageAdd: 'Favori eklemek için',
|
|
51
|
+
type: {
|
|
52
|
+
fiat: 'FIAT',
|
|
53
|
+
crypto: 'KRİPTO',
|
|
54
|
+
metal: 'METAL',
|
|
55
|
+
gold: 'ALTIN',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
help: {
|
|
59
|
+
usage: 'Kullanım',
|
|
60
|
+
examples: 'Örnekler',
|
|
61
|
+
crypto: 'Kripto',
|
|
62
|
+
metals: 'Metaller',
|
|
63
|
+
jewelry: 'Kuyumculuk',
|
|
64
|
+
config: 'Ayarlar',
|
|
65
|
+
alias: 'Özel Kısayollar',
|
|
66
|
+
aliasCreate: 'Kısayol oluştur',
|
|
67
|
+
aliasView: 'Kısayolları gör',
|
|
68
|
+
},
|
|
69
|
+
moon: {
|
|
70
|
+
toTheMoon: "Ay'a!",
|
|
71
|
+
goingToMoon: "AY'A GİDİYORUZ!",
|
|
72
|
+
tip: 'Güncel fiyatları görmek için',
|
|
73
|
+
},
|
|
74
|
+
display: {
|
|
75
|
+
goldOunce: 'Altın Ons',
|
|
76
|
+
goldKg: 'Gram Altın',
|
|
77
|
+
silverKg: 'Gümüş Kg',
|
|
78
|
+
silverOunce: 'Gümüş Ons',
|
|
79
|
+
quarterGold: 'Çeyrek Altın',
|
|
80
|
+
halfGold: 'Yarım Altın',
|
|
81
|
+
fullGold: 'Tam Altın',
|
|
82
|
+
ataGold: 'Ata Altın',
|
|
83
|
+
gremseGold: 'Gremse Altın',
|
|
84
|
+
},
|
|
85
|
+
cli: {
|
|
86
|
+
specifyCurrency: 'Bir para birimi belirtin',
|
|
87
|
+
usage: 'Kullanım',
|
|
88
|
+
invalidCommand: 'Geçersiz komut',
|
|
89
|
+
},
|
|
90
|
+
};
|