Adding translations directly to store
See original GitHub issueI’d like to use a single file to handle all of my translations similarly to below but I found that I need to import and use Vue.i18n.add('en', english)
on my root Vue instance instead of just being able to add them to the store. Is there a way around this?
I’d like to have something like below.
import Vue from 'vue';
import Vuex from 'vuex';
import english from './translations/english.json';
import german from './translations/german.json';
import french from './translations/french.json';
const debug = process.env.NODE_ENV !== 'production';
const store = new Vuex.Store({
strict: debug
});
// Add translations directly to the application
Vue.i18n.add('en', english);
Vue.i18n.add('ge', german);
Vue.i18n.add('fr', french);
// Set the start locale to use
Vue.i18n.set('en');
export default store;
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Translating and localizing your store - Shopify Help Center
You can translate the content of your online store by adding your own translations using CSV files, or by using a compatible third-party...
Read more >Translate and localize your app - Play Console Help
Open Play Console and go to Main store listing page (Grow > Store presence > Main store listing). At the top of the...
Read more >How to Translate Your Shopify Store in 4 Easy Steps - OneSky
Shopify makes it pretty easy to integrate your translations. Under Settings > Languages, you just choose the languages you want to add, and...
Read more >How to add multiple languages to Shopify - Weglot
The easiest and most complete way to translate your Shopify store is to use a multi-language translation app. You won't need to duplicate...
Read more >Creating a Multilingual WooCommerce Store [Ultimate Guide]
TranslatePress lets you translate your entire WordPress multilingual site, directly from the front-end, using a super intuitive visual ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi @OmgImAlexis,
I finally got around to look into this issue.
We actually apply some transformations to the locale data to flatten the information. This is done in the function flattenTranslations in vuex-i18n-store.js. We could export this function from the package to let you flatten the translation data on your own and then just set it on the store directly.
Aha. Now I understand. I will look into this.