Skip to content

Commit 902d2db

Browse files
committed
feat: add locale configuration support for Appwrite client
1 parent e156dd7 commit 902d2db

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ export default defineNuxtModule<ModuleOptions>({
4545
nuxt.hook('listen', () => {
4646
console.info(`Appwrite Endpoint: ${options.endpoint}`)
4747
console.info(`Appwrite Project: ${options.project}`)
48+
if(options.locale){
49+
console.info(`Appwrite Locale: ${options.locale}`)
50+
}
4851
})
4952
},
5053
})

src/runtime/plugin.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { defineNuxtPlugin } from '#app'
2020
export type AppwriteConfig = {
2121
endpoint: string
2222
project: string
23+
locale?: string
2324
}
2425

2526
export type Appwrite = {
@@ -48,10 +49,14 @@ export default defineNuxtPlugin((nuxtApp) => {
4849
const config: AppwriteConfig = {
4950
endpoint: moduleOptions.endpoint || 'https://cloud.appwrite.io/v1',
5051
project: moduleOptions.project,
52+
locale: moduleOptions.locale,
5153
}
5254
const client = new Client()
5355
client.setEndpoint(config.endpoint)
5456
client.setProject(config.project)
57+
if (config.locale) {
58+
client.setLocale(config.locale)
59+
}
5560

5661
return {
5762
provide: {

0 commit comments

Comments
 (0)