Skip to content

Commit a7efef7

Browse files
authored
Merge pull request #397 from rtrap95/main
feat: add locale configuration support for Appwrite client
2 parents e156dd7 + 384de25 commit a7efef7

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

README.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,13 @@ Appwrite API endpoint (Console -> Project -> Setting -> API Endpoint)
5050

5151
Appwrite project ID (Console -> Project -> Setting -> Project ID)
5252

53+
### Locale - `locale` - optional
54+
55+
- type: `String`
56+
- default: `en`
57+
58+
Appwrite locale
59+
5360
### Full Example
5461

5562
```js
@@ -60,6 +67,7 @@ export default {
6067
appwrite: {
6168
endpoint: 'https://cloud.appwrite.io/v1',
6269
project: 'nuxt-playground',
70+
locale: 'en'
6371
}
6472
}
6573
```
@@ -108,4 +116,4 @@ Copyright (c) Herdi Tr. <[email protected]>
108116
[codecov-href]: https://codecov.io/gh/Hrdtr/nuxt-appwrite
109117

110118
[license-src]: https://img.shields.io/npm/l/nuxt-appwrite.svg
111-
[license-href]: https://npmjs.com/package/nuxt-appwrite
119+
[license-href]: https://npmjs.com/package/nuxt-appwrite

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)