Add localization support for various components, including dialogs and views, in English, Spanish, and French. Implemented translations for user profile management, payment processes, and creator functionalities. Updated existing components to utilize the new translation system.
This commit is contained in:
26
frontend/src/stores/languageStore.js
Normal file
26
frontend/src/stores/languageStore.js
Normal file
@@ -0,0 +1,26 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { useSessionStorage } from '@vueuse/core'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
|
||||
export const useLanguageStore = defineStore(
|
||||
'language',
|
||||
() => {
|
||||
const { locale } = useI18n()
|
||||
|
||||
// Initialize with the stored value or default to 'fr'
|
||||
const storedLocale = useSessionStorage('user-locale', 'fr')
|
||||
|
||||
// Set the initial locale from storage
|
||||
locale.value = storedLocale.value
|
||||
|
||||
function setLocale(newLocale) {
|
||||
locale.value = newLocale
|
||||
storedLocale.value = newLocale
|
||||
}
|
||||
|
||||
return {
|
||||
locale: storedLocale,
|
||||
setLocale
|
||||
}
|
||||
}
|
||||
)
|
||||
@@ -65,6 +65,7 @@ export const useUserProfileStore = defineStore(
|
||||
|
||||
async function changeFullname(firstname, lastname) {
|
||||
try {
|
||||
const client = useClient()
|
||||
await client.post(
|
||||
`/api/users/fullname`,
|
||||
{
|
||||
@@ -80,6 +81,7 @@ export const useUserProfileStore = defineStore(
|
||||
|
||||
async function changeAlias(alias) {
|
||||
try {
|
||||
const client = useClient()
|
||||
await client.post(
|
||||
`/api/users/alias`,
|
||||
{
|
||||
@@ -93,6 +95,7 @@ export const useUserProfileStore = defineStore(
|
||||
|
||||
async function changeBirthday(birthdate) {
|
||||
try {
|
||||
const client = useClient()
|
||||
await client.post(
|
||||
`/api/users/birthdate`,
|
||||
{
|
||||
@@ -106,6 +109,7 @@ export const useUserProfileStore = defineStore(
|
||||
|
||||
async function changePhone(phoneNumber) {
|
||||
try {
|
||||
const client = useClient()
|
||||
await client.post(
|
||||
`/api/users/phone`,
|
||||
{
|
||||
@@ -119,6 +123,7 @@ export const useUserProfileStore = defineStore(
|
||||
|
||||
async function changeEmail(email) {
|
||||
try {
|
||||
const client = useClient()
|
||||
await client.post(
|
||||
`/api/users/email`,
|
||||
{
|
||||
@@ -132,6 +137,7 @@ export const useUserProfileStore = defineStore(
|
||||
|
||||
async function changeAddress(address) {
|
||||
try {
|
||||
const client = useClient()
|
||||
await client.post(
|
||||
`/api/users/address`,
|
||||
{
|
||||
@@ -145,6 +151,7 @@ export const useUserProfileStore = defineStore(
|
||||
|
||||
async function changePortrait(selectedFile) {
|
||||
try {
|
||||
const client = useClient()
|
||||
const formData = new FormData();
|
||||
formData.append('file', selectedFile)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user