mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-04-02 13:45:10 -05:00
include language in db settings
This commit is contained in:
parent
2e97c0a5fb
commit
35a558ec01
@ -38,6 +38,8 @@ export interface LanguageOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const SETTINGS_KEYS = {
|
export const SETTINGS_KEYS = {
|
||||||
|
LANGUAGE: 'language',
|
||||||
|
// maintain old general-settings: for backwards compatibility
|
||||||
BULK_EDIT_CONFIRMATION_DIALOGS:
|
BULK_EDIT_CONFIRMATION_DIALOGS:
|
||||||
'general-settings:bulk-edit:confirmation-dialogs',
|
'general-settings:bulk-edit:confirmation-dialogs',
|
||||||
BULK_EDIT_APPLY_ON_CLOSE: 'general-settings:bulk-edit:apply-on-close',
|
BULK_EDIT_APPLY_ON_CLOSE: 'general-settings:bulk-edit:apply-on-close',
|
||||||
@ -60,6 +62,11 @@ export const SETTINGS_KEYS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SETTINGS: PaperlessSettings[] = [
|
const SETTINGS: PaperlessSettings[] = [
|
||||||
|
{
|
||||||
|
key: SETTINGS_KEYS.LANGUAGE,
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
key: SETTINGS_KEYS.BULK_EDIT_CONFIRMATION_DIALOGS,
|
key: SETTINGS_KEYS.BULK_EDIT_CONFIRMATION_DIALOGS,
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
@ -379,11 +386,13 @@ export class SettingsService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getLanguage(): string {
|
getLanguage(): string {
|
||||||
return this.cookieService.get(this.getLanguageCookieName())
|
return this.get(SETTINGS_KEYS.LANGUAGE)
|
||||||
}
|
}
|
||||||
|
|
||||||
setLanguage(language: string) {
|
setLanguage(language: string) {
|
||||||
if (language) {
|
this.set(SETTINGS_KEYS.LANGUAGE, language)
|
||||||
|
if (language?.length) {
|
||||||
|
// for Django
|
||||||
this.cookieService.set(this.getLanguageCookieName(), language)
|
this.cookieService.set(this.getLanguageCookieName(), language)
|
||||||
} else {
|
} else {
|
||||||
this.cookieService.delete(this.getLanguageCookieName())
|
this.cookieService.delete(this.getLanguageCookieName())
|
||||||
@ -466,6 +475,10 @@ export class SettingsService {
|
|||||||
const value = localStorage.getItem(key)
|
const value = localStorage.getItem(key)
|
||||||
this.set(key, value)
|
this.set(key, value)
|
||||||
}
|
}
|
||||||
|
this.set(
|
||||||
|
SETTINGS_KEYS.LANGUAGE,
|
||||||
|
this.cookieService.get(this.getLanguageCookieName())
|
||||||
|
)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.toastService.showError(errorMessage)
|
this.toastService.showError(errorMessage)
|
||||||
console.log(error)
|
console.log(error)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user