Skip to content

Commit 62b7220

Browse files
committed
Fixed Localization bug
1 parent 1f38ac4 commit 62b7220

File tree

5 files changed

+33
-19
lines changed

5 files changed

+33
-19
lines changed

frontend/src/lib/i18n/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@
5454
"password": "Password",
5555
"no_groups_warning": "Be careful you have no server, this may cause you to not be able to connect properly to other computers.",
5656
"restore_default_servers": "Restore default values",
57-
"server-group-update": "Server group updated successfully"
57+
"server-group-update": "Server group updated successfully",
58+
"default-loading-title": "Waiting to resolve connection!",
59+
"default-loading-message": "Make sure to stay focused on this window"
5860
}

frontend/src/lib/i18n/es.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@
5454
"password": "Contraseña",
5555
"no_groups_warning": "Ten cuidado no tienes ningún servidor, esto puede provocar que no te puedas conectar correctamente con otros equipos",
5656
"restore_default_servers": "Restaurar los valores por defecto",
57-
"server-group-update": "Grupo de servidores actualizado"
57+
"server-group-update": "Grupo de servidores actualizado",
58+
"default-loading-title": "Esperando por la conexión",
59+
"default-loading-message": "No salgas de la pestaña durante el proceso"
5860
}

frontend/src/lib/i18n/gl.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,7 @@
5454
"password": "Contrasinal",
5555
"no_groups_warning": "Ten coidado non tes nengún servidor, isto pode provocar que non te podas conectar correctamente con outros equipos",
5656
"restore_default_servers": "Restaurar os valores por defecto",
57-
"server-group-update": "Grupo de servidores actualizado sen erros"
57+
"server-group-update": "Grupo de servidores actualizado sen erros",
58+
"default-loading-title": "Esperando pola conexión",
59+
"default-loading-message": "Non deixes esta xanela durante o proceso"
5860
}
Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,47 @@
1-
import { writable } from 'svelte/store';
1+
import { writable, get } from 'svelte/store';
2+
import { _ } from 'svelte-i18n';
23

34
interface LoadingStore {
45
loading: boolean;
5-
title: string;
6-
message: string;
6+
title?: string;
7+
message?: string;
78
}
89

910
const defaultLoadingStore: LoadingStore = {
10-
loading: false,
11-
title: 'Waiting to resolve connection!',
12-
message: 'Make sure to stay focused on this window'
13-
14-
}
11+
loading: false
12+
};
1513

1614
const loadingWritable = writable<LoadingStore>(defaultLoadingStore);
1715

1816
export function toogleLoading() {
19-
loadingWritable.update(store => {
17+
const currentLoading = get(loadingWritable);
18+
19+
if (!currentLoading.message && !currentLoading.title) {
20+
loadingWritable.update((store) => ({
21+
...store,
22+
title: get(_)('default-loading-title'),
23+
message: get(_)('default-loading-message')
24+
}));
25+
return;
26+
}
27+
28+
loadingWritable.update((store) => {
2029
const loading = !store.loading;
21-
30+
2231
if (loading) {
23-
return {...store, loading};
32+
return { ...store, loading };
2433
}
2534

2635
return defaultLoadingStore;
27-
2836
});
2937
}
3038

3139
export function setLoadingTitle(title: string) {
32-
loadingWritable.update(store => ({...store, title}));
40+
loadingWritable.update((store) => ({ ...store, title }));
3341
}
3442

3543
export function setLoadingMessage(message: string) {
36-
loadingWritable.update(store => ({...store, message}));
44+
loadingWritable.update((store) => ({ ...store, message }));
3745
}
3846

39-
export default loadingWritable;
47+
export default loadingWritable;

frontend/src/lib/webrtc/stream/host_stream_hook.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export function CreateHostStream() {
112112
if (!peerConnection) return;
113113

114114
if (peerConnection.connectionState === 'connected') {
115-
showToast('Connected', ToastType.SUCCESS);
115+
showToast(get(_)('connected'), ToastType.SUCCESS);
116116
return;
117117
}
118118
};

0 commit comments

Comments
 (0)