Comments (8)
Also have some similar issue.
If I am trying to include the translation files in .ts format,
path.resolve(__dirname, './src/translation/locales/**.ts'),
I will receive an empty message object from
import messages from '@intlify/unplugin-vue-i18n/messages';
But it still could find a json files, if you make an include option less specific.
Any idea how to configure the VueI18nPlugin
so it could see a .ts
files?
NOTE: I am using "@intlify/unplugin-vue-i18n": "^0.11.0"
from bundle-tools.
I have an issue which might be related. When updating to the latest dependencies, I get the following error when I execute vitest:
Error: Cannot find module ' @intlify/unplugin-vue-i18n/messages'.
It did work before updating vitest from 0.31.3 to 0.32.0
from bundle-tools.
This issue is the same, i have done the proposal of just import .ts and inject to VueI18nPlugin. This will allow to infer message types maybe without the need of create a vue-i18n.d.ts file declaring module with messageKeys
from bundle-tools.
@kazupon is loading js / ts files supported trough vite (@intlify/unplugin-vue-i18n/messages)? If not, can you point me in the right direction where this should be implemented, so I can make a PR.
from bundle-tools.
Ok sorry @kazupon i have check the code and didnt see that you have already implemented this 84348c1
When i have time i will test it and if i can, i will try to make a PR if i see some problem
from bundle-tools.
👋 Currently running into this same issue - anyone have a solution?
from bundle-tools.
I am using "@intlify/unplugin-vue-i18n": "^0.12.0" and am having the same problem, the documentation by @intlify/unplugin-vue-i18n is really bad
from bundle-tools.
I did some digging to try to figure out my own issue with this as I ran into it myself. Just writing my findings down in case someone else falls down the rabbithole.
From what I can tell currently by using the message compiler (@intlify/unplugin-vue-i18n/messages), it only handles files that has a yaml/json extension. Everything else is skipped.
It is possible to use the plugin with files with other extensions if you import the messages yourself:
import { createI18n } from 'vue-i18n';
import no from './locales/no.json';
import en from './locales/en';
const messages = {
no,
en,
};
const i18n = createI18n({
locale: 'en',
messages,
});
I guess more of a discussion at this point, but what is message-compiler planned to support?
My current problem is that we use identifiers to export localization-data and that doesn't work in the unplugin-versions so upgrading vite seems to be a hassle. The hack appears to be to return a function that returns the identifier (variable), but atleast it doesn't require a rewrite of everything.
from bundle-tools.
Related Issues (20)
- [Vue 2.7][vite] Custom blocks don't work in components that are written with Options API HOT 5
- YAML import not parsing Anchor HOT 1
- Module is a CommonJS module, which may not support all module.exports as named exports. HOT 8
- Webpack + vue.config.js failed to compile HOT 11
- Using i18n-t component + @intlify/unplugin-vue-i18n/vite causes error in build HOT 1
- Support TS format for messages
- unplugin-vue-i18n: regression with v0.9.1 - unexpected token: '{' HOT 10
- Unexpected token error after 0.9.0 @intlify/unplugin-vue-i18n HOT 3
- Error code : 2 after update to 0.10.0 @intlify/unplugin-vue-i18n HOT 3
- Types exports in package.json are wrong
- Switch escodegen to something else. It's dependency "word-wrap" is reported as having a security issue HOT 3
- ERROR [unplugin-vue-i18n] Detected HTML in (nuxt3, vite, vueI18n) HOT 17
- [Suggestion] In the usage section fix default locale path example HOT 2
- 'vue-i18n' or 'petite-vue-i18n' to be present in the dependency tree. HOT 1
- [vue-facing-decorator][vue-3][vue-i18n@9] bug to load local i18n bloc HOT 2
- Nuxt 3: Unexpected token 'export'. HOT 5
- Indirect dependency semver vulnerable to Regular Expression Denial of Service
- failed to load config vite.config.js HOT 1
- TS error unplugin-vue-i18n 0.12.3 in createI18n HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bundle-tools.