Skip to content

Commit 848cd30

Browse files
committed
Add all strings for translation
1 parent 39a3985 commit 848cd30

3 files changed

Lines changed: 36 additions & 20 deletions

File tree

frontend/src/composables/useSQLite.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {onMounted} from 'vue'
22
import initSqlJs from "sql.js";
33
import {useGlobalStatus} from "@/composables/useGlobalStatus.js";
4+
import i18n from "@/i18n/index.js";
45

56
const globalStatus = useGlobalStatus();
67
let isInitialized = false
@@ -16,7 +17,7 @@ export function useSQLite() {
1617
if (isInitialized)
1718
return
1819

19-
await globalStatus.startLoading('Loading SQL.js');
20+
await globalStatus.startLoading(i18n.global.t('Loading SQL.js'));
2021

2122
try {
2223
SQL = await initSqlJs({
@@ -26,7 +27,7 @@ export function useSQLite() {
2627
}
2728
catch (err) {
2829
console.error('Failed to load SQL.js:', err);
29-
globalStatus.status.value = 'Failed to load SQL.js'
30+
globalStatus.status.value = i18n.global.t('Failed to load SQL.js')
3031
globalStatus.error.value = err
3132
}
3233
finally {
@@ -39,7 +40,7 @@ export function useSQLite() {
3940
if (!isInitialized)
4041
initialize()
4142

42-
globalStatus.startLoading('Loading database...');
43+
globalStatus.startLoading(i18n.global.t('Loading database...'));
4344

4445
const reader = new FileReader();
4546

@@ -55,7 +56,7 @@ export function useSQLite() {
5556
}
5657
catch (err) {
5758
console.error('Error loading database:', err);
58-
globalStatus.status.value = 'Error loading database'
59+
globalStatus.status.value = i18n.global.t('Error loading database')
5960
globalStatus.error.value = err
6061
reject()
6162
}
@@ -66,7 +67,7 @@ export function useSQLite() {
6667

6768
reader.onerror = (err) => {
6869
globalStatus.finishLoading();
69-
globalStatus.status.value = 'Error reading file'
70+
globalStatus.status.value = i18n.global.t('Error reading file')
7071
globalStatus.error.value = err
7172
reject()
7273
}
@@ -79,7 +80,7 @@ export function useSQLite() {
7980
if (!db)
8081
return
8182

82-
await globalStatus.startLoading('Executing query...');
83+
await globalStatus.startLoading(i18n.global.t('Executing query...'));
8384
let results = null
8485

8586
try {
@@ -102,7 +103,7 @@ export function useSQLite() {
102103
}
103104
catch (err) {
104105
console.error('Failed execute query:', err, '\nRequest: ', sql, '\nParams: ', params);
105-
globalStatus.status.value = 'Failed execute query'
106+
globalStatus.status.value = i18n.global.t('Failed execute query')
106107
globalStatus.error.value = err
107108
}
108109
finally {

frontend/src/composables/useService.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const initSettings = async () => {
8585
}
8686

8787
const checkDbVersion = async (settings) => {
88-
globalStatus.status.value = 'Check collection'
88+
globalStatus.status.value = i18n.global.t('Check collection')
8989

9090
if (settings.type !== 'OpenNumismat') {
9191
globalStatus.error.value = i18n.global.t('wrong_version');
@@ -110,15 +110,15 @@ function MD5(d){var r = M(V(Y(X(d),8*d.length)));return r.toLowerCase()}function
110110

111111
export function useService(passwordDialogRef) {
112112
const checkDbPassword = async (settings) => {
113-
globalStatus.status.value = 'Check password'
113+
globalStatus.status.value = i18n.global.t('Check password')
114114

115115
if (MD5('') !== settings.password) {
116116
const enteredPassword = await passwordDialogRef.value.promptPassword()
117117
if (enteredPassword && MD5(enteredPassword) === settings.password) {
118118
return true
119119
}
120120
else {
121-
globalStatus.error.value = 'Wrong password'
121+
globalStatus.error.value = i18n.global.t('Wrong password')
122122
return false
123123
}
124124
}
@@ -129,7 +129,7 @@ export function useService(passwordDialogRef) {
129129
const getServerFileList = async () => {
130130
let serverFileList = [];
131131

132-
await globalStatus.startLoading('Connect to remote server');
132+
await globalStatus.startLoading(i18n.global.t('Connect to remote server'));
133133

134134
try {
135135
const response = await api.get('/api/filelist')
@@ -151,7 +151,7 @@ export function useService(passwordDialogRef) {
151151
let collectionFilters = {};
152152
let settingsDb = {};
153153

154-
await globalStatus.startLoading('Open collection');
154+
await globalStatus.startLoading(i18n.global.t('Open collection'));
155155

156156
try {
157157
const responseSettings = await api.get('/api/settings', {params: {f: file}})
@@ -185,7 +185,7 @@ export function useService(passwordDialogRef) {
185185
}
186186
}
187187

188-
await globalStatus.startLoading('Load collection');
188+
await globalStatus.startLoading(i18n.global.t('Load collection'));
189189

190190
try {
191191
const responseFilters = await api.get('/api/filters', {params: {f: file}})
@@ -277,7 +277,7 @@ export function useService(passwordDialogRef) {
277277
const loadCoinsRemote = async (search, sortBy, reverse, statusFilter, countryFilter, seriesFilter, typeFilter, periodFilter, mintFilter, file) => {
278278
let coinsList = [];
279279

280-
await globalStatus.startLoading('Load coins');
280+
await globalStatus.startLoading(i18n.global.t('Load coins'));
281281

282282
try {
283283
const responseCoins = await api.get('/api/coins', {params: {
@@ -474,7 +474,7 @@ export function useService(passwordDialogRef) {
474474
const getDetailsRemote = async (coinId, file) => {
475475
let coinData= [];
476476

477-
await globalStatus.startLoading('Request');
477+
await globalStatus.startLoading(i18n.global.t('Request'));
478478

479479
try {
480480
const response = await api.get('/api/coin_data', {params: {f: file, id: coinId}})
@@ -491,7 +491,7 @@ export function useService(passwordDialogRef) {
491491
}
492492

493493
const getDetailsLocal = async (coinId) => {
494-
let coinData= [];
494+
let coinData;
495495

496496
const sql = `SELECT ${ infoFields.join(',') } FROM coins
497497
LEFT JOIN photos AS obverseimg ON coins.obverseimg = obverseimg.id
@@ -513,7 +513,7 @@ export function useService(passwordDialogRef) {
513513
const getPhotosRemote = async (coinId, file) => {
514514
let photos= [];
515515

516-
await globalStatus.startLoading('Request');
516+
await globalStatus.startLoading(i18n.global.t('Request'));
517517

518518
try {
519519
const response = await api.get('/api/photos', {params: {f: file, id: coinId}})
@@ -530,7 +530,7 @@ export function useService(passwordDialogRef) {
530530
}
531531

532532
const getPhotosLocal = async (coinId) => {
533-
let photos= [];
533+
let photos;
534534

535535
const sql = `SELECT obverseimg.image, reverseimg.image, edgeimg.image, photo1.image, photo2.image, photo3.image, photo4.image FROM coins
536536
LEFT JOIN photos AS obverseimg ON coins.obverseimg = obverseimg.id
@@ -561,7 +561,7 @@ export function useService(passwordDialogRef) {
561561
const getSummaryRemote = async (file) => {
562562
let summary= {};
563563

564-
await globalStatus.startLoading('Request');
564+
await globalStatus.startLoading(i18n.global.t('Request'));
565565

566566
try {
567567
const response = await api.get('/api/summary', {params: {f: file}})

frontend/src/i18n/en.json

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,5 +48,20 @@
4848
"First purchase": "First purchase",
4949
"Interface": "Interface",
5050
"Server": "Server",
51-
"API Key": "API Key"
51+
"API Key": "API Key",
52+
"Loading SQL.js": "Loading SQL.js",
53+
"Failed to load SQL.js": "Failed to load SQL.js",
54+
"Loading database...": "Loading database...",
55+
"Error loading database": "Error loading database",
56+
"Error reading file": "Error reading file",
57+
"Executing query...": "Executing query...",
58+
"Failed execute query": "Failed to execute query",
59+
"Check collection": "Check collection",
60+
"Check password": "Check password",
61+
"Wrong password": "Wrong password",
62+
"Connect to remote server": "Connect to remote server",
63+
"Open collection": "Open collection",
64+
"Load collection": "Load collection",
65+
"Load coins": "Load coins",
66+
"Request": "Request"
5267
}

0 commit comments

Comments
 (0)