intlify / vue-i18n-extensions Goto Github PK
View Code? Open in Web Editor NEWvue-i18n extensions
License: MIT License
vue-i18n extensions
License: MIT License
Need add babel-runtime dependency to package.json or make plugin work without it.
In lib/util.js at line:7
var _stringify = require('babel-runtime/core-js/json/stringify');
Hi !
I am testing a Nuxt static generated app on Vercel. This app uses nuxt-i18n
which is using vue-i18n-extensions
After dependencies installation, when vercel run npm run generate
I get the following error :
17:15:43.695 | > [email protected] generate /vercel/61f2f93f
-- | --
17:15:43.695 | > nuxt generate
17:15:44.407 | FATAL Error parsing /vercel/61f2f93f/node_modules/vue-i18n-extensions/package.json: Unexpected token , in JSON at position 3089
17:15:44.407 | SyntaxError: Error parsing node_modules/vue-i18n-extensions/package.json: Unexpected token , in JSON at position 3089
17:15:44.407 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
17:15:44.418 | ╭──────────────────────────────────────────────────────────────────────────────────────╮
17:15:44.418 | │ │
17:15:44.418 | │ ✖ Nuxt Fatal Error │
17:15:44.418 | │ │
17:15:44.418 | │ SyntaxError: Error parsing │
17:15:44.418 | │ /vercel/61f2f93f/node_modules/vue-i18n-extensions/package.json: Unexpected token │
17:15:44.418 | │ , in JSON at position 3089 │
17:15:44.418 | │ │
17:15:44.418 | ╰──────────────────────────────────────────────────────────────────────────────────────╯
17:15:44.432 | npm ERR! code ELIFECYCLE
17:15:44.432 | npm ERR! errno 1
17:15:44.433 | npm ERR! [email protected] generate: `nuxt generate`
17:15:44.433 | npm ERR! Exit status 1
17:15:44.433 | npm ERR!
17:15:44.433 | npm ERR! Failed at the [email protected] generate script.
17:15:44.433 | npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
17:15:44.440 | npm ERR! A complete log of this run can be found in:
17:15:44.440 | npm ERR! /vercel/.npm/_logs/2020-09-04T15_15_44_434Z-debug.log
17:15:44.445 | Error: Command "npm run generate" exited with 1
17:15:47.471 | Done with "package.json"
Here are an overview of my app dependencies :
"dependencies": {
3 "@nuxtjs/axios": "^5.12.2",
4 "@nuxtjs/google-tag-manager": "^2.3.2",
5 "@nuxtjs/sitemap": "^1.2.0",
18 "nuxt": "^2.14.4",
19 "nuxt-i18n": "^4.1.0",
41 },
It's working in local and in other environments. Do you have some clues about this issue ?
Do you think it's related to Node version ?
Thanks 👍 !
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
This repository currently has no open or pending branches.
.github/workflows/ci.yml
actions/checkout v4
actions/setup-node v4
actions/checkout v4
actions/setup-node v4
actions/checkout v4
actions/setup-node v4
actions/cache v4
actions/checkout v4
actions/setup-node v4
.github/workflows/github-label-sync.yml
r7kamura/github-label-sync-action v0
.github/workflows/release.yml
actions/checkout v4
actions/setup-node v4
jungwinter/split v2
stefanzweifel/git-auto-commit-action v5
.github/workflows/reproduire.yml
actions/checkout v4
Hebilicious/reproduire v0.0.9@4b686ae9cbb72dad60f001d278b6e3b2ce40a9ac
.github/workflows/typos.yml
actions/checkout v4
crate-ci/typos v1.22.9
example/package.json
vue ^3.4.27
vue-i18n ^9.0.0
@vitejs/plugin-vue ^5.0.4
typescript ^5.0.2
vite ^5.2.11
vue-tsc ^2.0.17
package.json
@babel/parser ^7.24.6
@intlify/shared ^9.0.0
@vue/compiler-dom ^3.2.45
vue-i18n ^9.0.0
@babel/types ^7.24.6
@eslint/js ^9.2.0
@microsoft/api-extractor ^7.18.4
@types/eslint ^8.56.10
@types/node ^20.13.0
@vitest/coverage-v8 ^1.6.0
@vue/compiler-core ^3.2.45
@vue/compiler-sfc ^3.2.45
@vue/compiler-ssr ^3.2.45
@vue/runtime-dom ^3.2.45
@vue/server-renderer ^3.2.45
api-docs-gen ^0.4.0
bumpp ^9.4.1
eslint ^9.2.0
get-port-please ^3.1.2
gh-changelogen ^0.2.8
globals ^15.0.0
jsdom ^24.0.0
lint-staged ^15.2.5
npm-run-all2 ^6.0.0
opener ^1.5.2
pkg-types ^1.1.1
playwright ^1.44.0
prettier ^3.2.5
tsx ^4.11.0
typescript ^5.4.5
typescript-eslint ^7.9.0
unbuild ^2.0.0
vitest ^1.6.0
vue ^3.2.45
@intlify/shared ^9.0.0 || ^10.0.0
@vue/compiler-dom ^3.0.0
vue ^3.0.0
vue-i18n ^9.0.0 || ^10.0.0
node >= 18
pnpm 9.4.0
The following error occurs when t
exported with useI18n
is used as an alias:
<script>
import { useI18n } from 'vue-i18n'
export default {
setup() {
const { t: translation } = useI18n({
locale: 'en',
inheritLocale: false,
messages: {
en: {
apple: 'no apples | one apple | {count} apples',
banana: 'no bananas | {n} banana | {n} bananas',
dessert: 'I eat @:{name}!'
}
}
})
return { translation }
},
}
</script>
System:
OS: macOS 13.6.6
CPU: (10) arm64 Apple M1 Max
Memory: 156.13 MB / 64.00 GB
Shell: 5.9 - /bin/zsh
n/a
not work for <script setup>
, because, v-t
does not transform for $setup
.
This packaged is pulled by nuxt-i18n, and #30 breaks my app because lookbehind assertions are not supported by many browsers. I'm not familiar with the context that regex is used in, but could another solution be found?
my translation key is: 'cart.ipn.add.new.button'
I use it like this
<span v-t="'cart.ipn.add.new.button'"></span>
but it does not get hit but the compilerModule since it returns true for this regex:
const ecmaKeywordsRE = new RegExp('\\b' + (
'delete,typeof,instanceof,void,do,if,for,let,new,try,var,case,else,with,await,break,catch,class,const,' +
'alert,eval,super,throw,while,yield,delete,export,import,return,switch,default,' +
'extends,finally,continue,debugger,function,arguments'
).split(',').join('\\b|\\b') + '\\b')
[email protected] (with [email protected])
[email protected]
[email protected]
Open the online demo link:
{{ $t('xxx') }}
shows immediately (SSR) but v-t="'xxx'"
shows a bit later (no SSR)<router-link class="curly_bracket">{{ $t('curly_bracket') }}</router-link>
<router-link class="directive" v-t="'directive'" />
renders to:
<a class="curly_bracket">Using {{ }}, shows in SSR!</a>
<a class="directive"></a>
Only {{ $t() }}
is server side rendered, v-t="'xxx"
isn't.
This SSR directive works with primitive html tags, but when using with vue components such as <router-link>
, it fails.
v-t
directive on <router-link>
to work with SSR
v-t
directive only works with primitive html elements, but not with vue components such as <router-link>
.
Thank you so much!
Hello!
I'm working on a Nuxt 3 project using i18n and everything worked fine until I used this plugin for the v-t directive compatibility with SSR, and I wasn't able to replicate the config steps for it to work.
Could it be possible to make this plugin work with Nuxt 3?
Thanks in advance!
There is an error with this repository's Renovate configuration that needs to be fixed. As a precaution, Renovate will stop PRs until it is resolved.
Error type: undefined. Note: this is a nested preset so please contact the preset author if you are unable to fix it yourself.
vue-i18n-extensions will soon be transferred to intlify organaization. After that, it will be developed and maintained on intlify.
The vue-i18n-extensions
that has been released on npm will be released as @intlify/vue-i18n-extensions
in near future.
Intlify is a new i18n project kickoff by @kazupon. 😉
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.