Skip to content

Commit 0d8c5b8

Browse files
committed
feat: add i18n support
1 parent 0c0a3b3 commit 0d8c5b8

File tree

15 files changed

+450
-24
lines changed

15 files changed

+450
-24
lines changed

README.md

+10-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# Auth UI Vue
22

3-
![@nuxtbase/auth-ui-vue minzip package size](https://img.shields.io/bundlephobia/minzip/@nuxtbase/auth-ui-vue)
4-
![@nuxtbase/auth-ui-vue package version](https://img.shields.io/npm/v/@nuxtbase/auth-ui-vue.svg?colorB=green)
3+
[![NPM][npmBadge]][npmUrl]
4+
[![Minzip Package][bundlePhobiaBadge]][bundlePhobiaUrl]
5+
[![NPM Download][npmDtBadge]][npmDtUrl]
56
[![Netlify Status](https://api.netlify.com/api/v1/badges/a855cf9a-2ec2-448a-a6a4-9661815bcb97/deploy-status)](https://app.netlify.com/sites/auth-ui-vue/deploys)
67

8+
[npmBadge]: https://img.shields.io/npm/v/@nuxtbase/auth-ui-vue.svg?maxAge=2592000
9+
[npmUrl]: https://www.npmjs.com/package/@nuxtbase/auth-ui-vue
10+
[npmDtBadge]: https://img.shields.io/npm/dt/@nuxtbase/auth-ui-vue.svg
11+
[npmDtUrl]: https://www.npmjs.com/package/@nuxtbase/auth-ui-vue
12+
[bundlePhobiaBadge]: https://img.shields.io/bundlephobia/minzip/@nuxtbase/auth-ui-vue
13+
[bundlePhobiaUrl]: https://bundlephobia.com/package/@nuxtbase/auth-ui-vue@lasted
14+
715
> Pre-built auth widgets to get started in minutes.
816
917
## Preview

components.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ declare module '@vue/runtime-core' {
1818
'Mdi:heart': typeof import('~icons/mdi/heart')['default']
1919
'Ri:moonLine': typeof import('~icons/ri/moon-line')['default']
2020
'Ri:sunLine': typeof import('~icons/ri/sun-line')['default']
21+
'Ri:translate2': typeof import('~icons/ri/translate2')['default']
2122
ToggleButton: typeof import('./src/components/ToggleButton.vue')['default']
2223
}
2324
}

package.json

+2
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
},
4242
"devDependencies": {
4343
"@iconify/json": "^2.1.104",
44+
"@intlify/unplugin-vue-i18n": "^0.12.2",
4445
"@stitches/core": "^1.2.8",
4546
"@supabase/auth-ui-shared": "^0.1.6",
4647
"@supabase/supabase-js": "^2.31.0",
@@ -61,6 +62,7 @@
6162
"vite-plugin-lib-inject-css": "^1.2.0",
6263
"vite-plugin-vue-devtools": "1.0.0-rc.0",
6364
"vue": "^3.3.4",
65+
"vue-i18n": "9",
6466
"vue-tsc": "^1.8.6"
6567
}
6668
}

packages/Auth.vue packages/auth/Auth.vue

+13-9
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ import { I18nVariables, ViewType, en, merge } from '@supabase/auth-ui-shared'
7070
import { createStitches } from '@stitches/core'
7171
import cloneDeep from 'lodash.clonedeep'
7272
73-
import { AuthProps, AuthViewKey } from './types'
74-
import SocialAuthContainer from './auth/SocialAuthContainer.vue'
75-
import EmailAuth from './auth/EmailAuth.vue'
76-
import SocialAuth from './auth/SocialAuth.vue'
77-
import MagicLink from './auth/MagicLink.vue'
78-
import ForgottenPassword from './auth/ForgottenPassword.vue'
79-
import UpdatePassword from './auth/UpdatePassword.vue'
80-
import VerifyOtp from './auth/VerifyOtp.vue'
73+
import { AuthProps, AuthViewKey } from '../types'
74+
import SocialAuthContainer from './SocialAuthContainer.vue'
75+
import EmailAuth from './EmailAuth.vue'
76+
import SocialAuth from './SocialAuth.vue'
77+
import MagicLink from './MagicLink.vue'
78+
import ForgottenPassword from './ForgottenPassword.vue'
79+
import UpdatePassword from './UpdatePassword.vue'
80+
import VerifyOtp from './VerifyOtp.vue'
8181
8282
const props = withDefaults(defineProps<AuthProps>(), {
8383
view: 'sign_in',
@@ -100,7 +100,11 @@ provide(AuthViewKey, {
100100
/**
101101
* Localization support
102102
*/
103-
const i18n: I18nVariables = merge(en, props?.localization?.variables ?? {})
103+
const i18n = computed<I18nVariables>(() => {
104+
const defaultLanguage = cloneDeep(en)
105+
const newlanguage = cloneDeep(props?.localization?.variables)
106+
return merge(defaultLanguage, newlanguage ?? {})
107+
})
104108
105109
/**
106110
* Simple boolean to detect if authView 'sign_in' or 'sign_up' or 'magic_link' is used

packages/auth/UpdatePassword.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
type="password"
1818
name="password"
1919
autofocus
20-
:placeholder="labels?.password_label"
20+
:placeholder="labels?.password_input_placeholder"
2121
:appearance="appearance"
2222
v-model="password"
2323
/>

packages/component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export { default as Auth } from './Auth.vue'
1+
export { default as Auth } from './auth/Auth.vue'
22
export {
33
default as UserContextProvider,
44
useSupabaseUser

0 commit comments

Comments
 (0)