diff --git a/js/src/graphql/user.ts b/js/src/graphql/user.ts index 190ecb350..d4afba217 100644 --- a/js/src/graphql/user.ts +++ b/js/src/graphql/user.ts @@ -106,6 +106,7 @@ export const USER_SETTINGS_FRAGMENT = gql` export const USER_SETTINGS = gql` query UserSetting { loggedUser { + locale settings { ...UserSettingFragment } @@ -189,3 +190,12 @@ export const GET_USER = gql` } } `; + +export const UPDATE_USER_LOCALE = gql` + mutation UpdateUserLocale($locale: String!) { + updateLocale(locale: $locale) { + id + locale + } + } +`; diff --git a/js/src/i18n/en_US.json b/js/src/i18n/en_US.json index 92271d7bd..fad695698 100644 --- a/js/src/i18n/en_US.json +++ b/js/src/i18n/en_US.json @@ -644,5 +644,6 @@ "more than 1360 contributors": "more than 1360 contributors", "{moderator} has unsuspended profile {profile}": "{moderator} has unsuspended profile {profile}", "{moderator} has deleted user {user}": "{moderator} has deleted user {user}", - "Change timezone": "Change timezone" + "Change timezone": "Change timezone", + "Select a language": "Select a language" } diff --git a/js/src/i18n/fr_FR.json b/js/src/i18n/fr_FR.json index c93fec9eb..68bdd12d2 100644 --- a/js/src/i18n/fr_FR.json +++ b/js/src/i18n/fr_FR.json @@ -667,5 +667,6 @@ "more than 1360 contributors": "plus de 1360 contributeur·ices", "{moderator} has unsuspended profile {profile}": "{moderator} a annulé la suspension de {profile}", "{moderator} has deleted user {user}": "{moderator} a supprimé l'utilisateur·ice {user}", - "Change timezone": "Changer de fuseau horaire" + "Change timezone": "Changer de fuseau horaire", + "Select a language": "Choisissez une langue" } diff --git a/js/src/i18n/langs.json b/js/src/i18n/langs.json new file mode 100644 index 000000000..d9916fb71 --- /dev/null +++ b/js/src/i18n/langs.json @@ -0,0 +1,30 @@ +{ + "ar": "العربية", + "bg": "Български", + "be": "Беларуская мова", + "br": "Brezhoneg", + "ca": "Català", + "co": "Corsu", + "cs": "čeština", + "de": "Deutsch", + "en": "English", + "eo": "Esperanto", + "es": "Español", + "fi": "suomi", + "fr": "Français", + "gl": "Galego", + "hu": "Magyar", + "it": "Italiano", + "ja": "日本語", + "nl": "Dutch", + "oc": "Occitan", + "pl": "Polski", + "pt": "Português", + "pt_PT": "Português (Portugal)", + "ru": "Русский", + "sq": "Shqip", + "sv": "Svenska", + "tr": "Türkçe", + "vi": "Tiếng Việt", + "zh_Hant_TW": "繁體中文(台灣)" +} diff --git a/js/src/types/current-user.model.ts b/js/src/types/current-user.model.ts index 327421746..5eb7a2034 100644 --- a/js/src/types/current-user.model.ts +++ b/js/src/types/current-user.model.ts @@ -17,12 +17,12 @@ export interface ICurrentUser { defaultActor: IPerson; drafts: IEvent[]; settings: IUserSettings; + locale: string; } export interface IUser extends ICurrentUser { confirmedAt: Date; confirmationSendAt: Date; - locale: String; actors: IPerson[]; disabled: boolean; } diff --git a/js/src/views/Settings/Preferences.vue b/js/src/views/Settings/Preferences.vue index f0efe1992..7f28d4e11 100644 --- a/js/src/views/Settings/Preferences.vue +++ b/js/src/views/Settings/Preferences.vue @@ -1,5 +1,16 @@ + + + + {{ language }} + + + - {{ + {{ $t("Timezone detected as {timezone}.", { timezone: Intl.DateTimeFormat().resolvedOptions().timeZone, }) - }} + }}