mirror of
https://github.com/Fabio286/antares.git
synced 2025-06-05 21:59:22 +02:00
refactor: ts on i18n
This commit is contained in:
@ -107,7 +107,7 @@ module.exports = {
|
|||||||
changelog: 'Logs de alteração',
|
changelog: 'Logs de alteração',
|
||||||
format: 'Formato',
|
format: 'Formato',
|
||||||
sshTunnel: 'SSH túnel',
|
sshTunnel: 'SSH túnel',
|
||||||
structure: 'Estrutura',
|
structure: 'Estrutura',
|
||||||
small: 'Pequeno',
|
small: 'Pequeno',
|
||||||
medium: 'Médio',
|
medium: 'Médio',
|
||||||
large: 'Grande',
|
large: 'Grande',
|
@ -1,4 +1,4 @@
|
|||||||
export const localesNames = {
|
export const localesNames: {[key: string]: string} = {
|
||||||
'en-US': 'English',
|
'en-US': 'English',
|
||||||
'it-IT': 'Italiano',
|
'it-IT': 'Italiano',
|
||||||
'ar-SA': 'العربية',
|
'ar-SA': 'العربية',
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { defineStore, acceptHMRUpdate } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
const persistentStore = new Store({ name: 'notes' });
|
const persistentStore = new Store({ name: 'notes' });
|
||||||
|
|
||||||
@ -7,12 +7,9 @@ export const useScratchpadStore = defineStore('scratchpad', {
|
|||||||
notes: persistentStore.get('notes', '# HOW TO SUPPORT ANTARES\n\n- [ ] Leave a star to Antares [GitHub repo](https://github.com/antares-sql/antares)\n- [ ] Send feedbacks and advices\n- [ ] Report for bugs\n- [ ] If you enjoy, share Antares with friends\n\n# ABOUT SCRATCHPAD\n\nThis is a scratchpad where you can save your **personal notes**. It supports `markdown` format, but you are free to use plain text.\nThis content is just a placeholder, feel free to clear it to make space for your notes.\n')
|
notes: persistentStore.get('notes', '# HOW TO SUPPORT ANTARES\n\n- [ ] Leave a star to Antares [GitHub repo](https://github.com/antares-sql/antares)\n- [ ] Send feedbacks and advices\n- [ ] Report for bugs\n- [ ] If you enjoy, share Antares with friends\n\n# ABOUT SCRATCHPAD\n\nThis is a scratchpad where you can save your **personal notes**. It supports `markdown` format, but you are free to use plain text.\nThis content is just a placeholder, feel free to clear it to make space for your notes.\n')
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
changeNotes (notes) {
|
changeNotes (notes: string) {
|
||||||
this.notes = notes;
|
this.notes = notes;
|
||||||
persistentStore.set('notes', this.notes);
|
persistentStore.set('notes', this.notes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (import.meta.webpackHot)
|
|
||||||
import.meta.webpackHot.accept(acceptHMRUpdate(useScratchpadStore, import.meta.webpackHot));
|
|
@ -1,4 +1,4 @@
|
|||||||
import { defineStore, acceptHMRUpdate } from 'pinia';
|
import { defineStore } from 'pinia';
|
||||||
import i18n from '@/i18n';
|
import i18n from '@/i18n';
|
||||||
import Store from 'electron-store';
|
import Store from 'electron-store';
|
||||||
const persistentStore = new Store({ name: 'settings' });
|
const persistentStore = new Store({ name: 'settings' });
|
||||||
@ -6,73 +6,72 @@ const isDarkTheme = window.matchMedia('(prefers-color-scheme: dark)');
|
|||||||
const defaultAppTheme = isDarkTheme.matches ? 'dark' : 'light';
|
const defaultAppTheme = isDarkTheme.matches ? 'dark' : 'light';
|
||||||
const defaultEditorTheme = isDarkTheme.matches ? 'twilight' : 'sqlserver';
|
const defaultEditorTheme = isDarkTheme.matches ? 'twilight' : 'sqlserver';
|
||||||
|
|
||||||
|
export type EditorFontSize = 'small' | 'medium' | 'large';
|
||||||
|
|
||||||
export const useSettingsStore = defineStore('settings', {
|
export const useSettingsStore = defineStore('settings', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
locale: persistentStore.get('locale', 'en-US'),
|
locale: persistentStore.get('locale', 'en-US') as string,
|
||||||
allowPrerelease: persistentStore.get('allow_prerelease', true),
|
allowPrerelease: persistentStore.get('allow_prerelease', true) as boolean,
|
||||||
explorebarSize: persistentStore.get('explorebar_size', null),
|
explorebarSize: persistentStore.get('explorebar_size', null) as number,
|
||||||
notificationsTimeout: persistentStore.get('notifications_timeout', 5),
|
notificationsTimeout: persistentStore.get('notifications_timeout', 5) as number,
|
||||||
dataTabLimit: persistentStore.get('data_tab_limit', 1000),
|
dataTabLimit: persistentStore.get('data_tab_limit', 1000) as number,
|
||||||
autoComplete: persistentStore.get('auto_complete', true),
|
autoComplete: persistentStore.get('auto_complete', true) as boolean,
|
||||||
lineWrap: persistentStore.get('line_wrap', true),
|
lineWrap: persistentStore.get('line_wrap', true) as boolean,
|
||||||
applicationTheme: persistentStore.get('application_theme', defaultAppTheme),
|
applicationTheme: persistentStore.get('application_theme', defaultAppTheme) as string,
|
||||||
editorTheme: persistentStore.get('editor_theme', defaultEditorTheme),
|
editorTheme: persistentStore.get('editor_theme', defaultEditorTheme) as string,
|
||||||
editorFontSize: persistentStore.get('editor_font_size', 'medium'),
|
editorFontSize: persistentStore.get('editor_font_size', 'medium') as EditorFontSize,
|
||||||
restoreTabs: persistentStore.get('restore_tabs', true),
|
restoreTabs: persistentStore.get('restore_tabs', true) as boolean,
|
||||||
disableBlur: persistentStore.get('disable_blur', false)
|
disableBlur: persistentStore.get('disable_blur', false) as boolean
|
||||||
}),
|
}),
|
||||||
actions: {
|
actions: {
|
||||||
changeLocale (locale) {
|
changeLocale (locale: string) {
|
||||||
this.locale = locale;
|
this.locale = locale;
|
||||||
i18n.global.locale = locale;
|
i18n.global.locale = locale;
|
||||||
persistentStore.set('locale', this.locale);
|
persistentStore.set('locale', this.locale);
|
||||||
},
|
},
|
||||||
changePageSize (limit) {
|
changePageSize (limit: number) {
|
||||||
this.dataTabLimit = limit;
|
this.dataTabLimit = limit;
|
||||||
persistentStore.set('data_tab_limit', this.dataTabLimit);
|
persistentStore.set('data_tab_limit', this.dataTabLimit);
|
||||||
},
|
},
|
||||||
changeAllowPrerelease (allow) {
|
changeAllowPrerelease (allow: boolean) {
|
||||||
this.allowPrerelease = allow;
|
this.allowPrerelease = allow;
|
||||||
persistentStore.set('allow_prerelease', this.allowPrerelease);
|
persistentStore.set('allow_prerelease', this.allowPrerelease);
|
||||||
},
|
},
|
||||||
updateNotificationsTimeout (timeout) {
|
updateNotificationsTimeout (timeout: number) {
|
||||||
this.notificationsTimeout = timeout;
|
this.notificationsTimeout = timeout;
|
||||||
persistentStore.set('notifications_timeout', this.notificationsTimeout);
|
persistentStore.set('notifications_timeout', this.notificationsTimeout);
|
||||||
},
|
},
|
||||||
changeExplorebarSize (size) {
|
changeExplorebarSize (size: number) {
|
||||||
this.explorebarSize = size;
|
this.explorebarSize = size;
|
||||||
persistentStore.set('explorebar_size', this.explorebarSize);
|
persistentStore.set('explorebar_size', this.explorebarSize);
|
||||||
},
|
},
|
||||||
changeAutoComplete (val) {
|
changeAutoComplete (val: boolean) {
|
||||||
this.autoComplete = val;
|
this.autoComplete = val;
|
||||||
persistentStore.set('auto_complete', this.autoComplete);
|
persistentStore.set('auto_complete', this.autoComplete);
|
||||||
},
|
},
|
||||||
changeLineWrap (val) {
|
changeLineWrap (val: boolean) {
|
||||||
this.lineWrap = val;
|
this.lineWrap = val;
|
||||||
persistentStore.set('line_wrap', this.lineWrap);
|
persistentStore.set('line_wrap', this.lineWrap);
|
||||||
},
|
},
|
||||||
changeApplicationTheme (theme) {
|
changeApplicationTheme (theme: string) {
|
||||||
this.applicationTheme = theme;
|
this.applicationTheme = theme;
|
||||||
persistentStore.set('application_theme', this.applicationTheme);
|
persistentStore.set('application_theme', this.applicationTheme);
|
||||||
},
|
},
|
||||||
changeEditorTheme (theme) {
|
changeEditorTheme (theme: string) {
|
||||||
this.editorTheme = theme;
|
this.editorTheme = theme;
|
||||||
persistentStore.set('editor_theme', this.editorTheme);
|
persistentStore.set('editor_theme', this.editorTheme);
|
||||||
},
|
},
|
||||||
changeEditorFontSize (size) {
|
changeEditorFontSize (size: EditorFontSize) {
|
||||||
this.editorFontSize = size;
|
this.editorFontSize = size;
|
||||||
persistentStore.set('editor_font_size', this.editorFontSize);
|
persistentStore.set('editor_font_size', this.editorFontSize);
|
||||||
},
|
},
|
||||||
changeRestoreTabs (val) {
|
changeRestoreTabs (val: boolean) {
|
||||||
this.restoreTabs = val;
|
this.restoreTabs = val;
|
||||||
persistentStore.set('restore_tabs', this.restoreTabs);
|
persistentStore.set('restore_tabs', this.restoreTabs);
|
||||||
},
|
},
|
||||||
changeDisableBlur (val) {
|
changeDisableBlur (val: boolean) {
|
||||||
this.disableBlur = val;
|
this.disableBlur = val;
|
||||||
persistentStore.set('disable_blur', this.disableBlur);
|
persistentStore.set('disable_blur', this.disableBlur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (import.meta.webpackHot)
|
|
||||||
import.meta.webpackHot.accept(acceptHMRUpdate(useSettingsStore, import.meta.webpackHot));
|
|
Reference in New Issue
Block a user