INL / corpus-frontend

BlackLab Frontend, a feature-rich corpus search interface for BlackLab.
16 stars 7 forks source link

Can we use https://github.com/kazupon/vue-i18n to do the internationalization task? #477

Closed fishfree closed 4 months ago

fishfree commented 5 months ago

If we can, are there any differences with this tutorial?

BTW: What's the roadmap of upgrading to Vue 3?

KCMertens commented 5 months ago

Yes, vue-i18n is fine, I've used it in the past :)

We don't use the vue-cli as it didn't work very well yet when this project was started, there's also no vue-router currently.

But you should be able to manually install it using npm i -S vue-i18n@8 (or whatever is the latest version compatible with vue 2), The rest of the steps seem straightforward and should work. create a file like

// src/frontend/src/i18n.ts
import Vue from 'vue';
import VueI18n from 'vue-i18n';

const messages = {
    en: {
            // import english localization 
    },
       // etc
};

Vue.use(VueI18n);
export default new VueI18n({
    locale: 'en',
    messages
});
// search.tsx/etc.
import i18n from 'src/i18n';
new Vue({
    i18n
    store: RootStore.store,
    render: h => h(SearchPageComponent),
})

I can't pin a date on moving to Vue 3, definitely sooner rather than later, but not super soon. I've given it a quick try in the past, but ran into some things that took some more time to solve than I had at that moment, though I can't recall exactly what the issue was. From the top of my head, the Vuex store will require rewriting, as the wrapper library that I used to get typescript support doesn't support Vue 3. There's a few rxjs things that might need porting as well, but not many.

KCMertens commented 4 months ago

Let's continue in #461