Vue 3 - Access value of locale in components in order to send to backend API #828
              
                Unanswered
              
          
                  
                    
                      jordan-kaxig
                    
                  
                
                  asked this question in
                Q&A
              
            Replies: 1 comment 1 reply
-
| In the component with composition API, you can access the global with  If you need to a global instance like  | 
Beta Was this translation helpful? Give feedback.
                  
                    1 reply
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
In my components, I need to access the current value of the locale variable, in order to send it to the backend so that response messages from the backend are returned in the correct language.
I've tried to access i18.locale and i18n.global.locale but of course VS Code says 'i18n' is not defined
All examples i've found is in Vue 2, where they use like this.$root.i18.n... and stuff, and that won't work in Vue 3.
Beta Was this translation helpful? Give feedback.
All reactions