File tree Expand file tree Collapse file tree 5 files changed +12
-1
lines changed Expand file tree Collapse file tree 5 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ Aquí están todas las opciones disponibles al configurar el módulo y sus valor
62
62
// preferred language to prevent subsequent redirections
63
63
// Set to false to redirect every time
64
64
useCookie: true ,
65
+ // Set to override the default domain of the cookie. Defaults to host of the site.
66
+ cookieDomain: null
65
67
// Cookie name
66
68
cookieKey: ' i18n_redirected' ,
67
69
// Set to always redirect to value stored in the cookie, not just once
Original file line number Diff line number Diff line change @@ -62,6 +62,8 @@ Here are all the options available when configuring the module and their default
62
62
// preferred language to prevent subsequent redirections
63
63
// Set to false to redirect every time
64
64
useCookie: true ,
65
+ // Set to override the default domain of the cookie. Defaults to host of the site.
66
+ cookieDomain: null
65
67
// Cookie name
66
68
cookieKey: ' i18n_redirected' ,
67
69
// Set to always redirect to value stored in the cookie, not just once
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ exports.DEFAULT_OPTIONS = {
35
35
rootRedirect : null ,
36
36
detectBrowserLanguage : {
37
37
useCookie : true ,
38
+ cookieDomain : null ,
38
39
cookieKey : 'i18n_redirected' ,
39
40
alwaysRedirect : false ,
40
41
fallbackLocale : null
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ export default async (context) => {
86
86
} , { preserveState : ! ! store . state [ vuex . moduleName ] } )
87
87
}
88
88
89
- const { useCookie, cookieKey } = detectBrowserLanguage
89
+ const { useCookie, cookieKey, cookieDomain } = detectBrowserLanguage
90
90
91
91
const getLocaleCookie = ( ) => {
92
92
if ( useCookie ) {
@@ -109,6 +109,11 @@ export default async (context) => {
109
109
path : '/' ,
110
110
sameSite : 'lax'
111
111
}
112
+
113
+ if ( cookieDomain ) {
114
+ cookieOptions . domain = cookieDomain
115
+ }
116
+
112
117
if ( process . client ) {
113
118
JsCookie . set ( cookieKey , locale , cookieOptions )
114
119
} else if ( res ) {
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ declare namespace NuxtVueI18n {
26
26
27
27
interface DetectBrowserLanguageInterface {
28
28
useCookie ?: boolean
29
+ cookieDomain ?: string | null
29
30
cookieKey ?: string
30
31
alwaysRedirect ?: boolean
31
32
fallbackLocale ?: Locale | null
You can’t perform that action at this time.
0 commit comments