Giter VIP home page Giter VIP logo

vue-i18n-extensions's People

Contributors

aggre avatar bobbiegoede avatar dependabot-preview[bot] avatar dependabot[bot] avatar ewohlken2 avatar kazupon avatar lucaswerkmeister avatar renovate[bot] avatar simon-he95 avatar wvffle avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

vue-i18n-extensions's Issues

Add dependency to package.json

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');

Error when using nuxt-i18n dep in Nuxt

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 👍 !

Dependency Dashboard

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.

Detected dependencies

github-actions
.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
npm
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

  • Check this box to trigger a request for Renovate to run again on this repository

`_ctx.t is not a function` error

Describe the bug

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>

Reproduction

dd1273b

System Info

System:
    OS: macOS 13.6.6
    CPU: (10) arm64 Apple M1 Max
    Memory: 156.13 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh

Used Package Manager

n/a

Additional context

not work for <script setup> , because, v-t does not transform for $setup.

you can see the SSR tab in vue playground
https://play.vuejs.org/#eNq9U11r2zAU/SuaGDiB2F6aPYyQlH1QWPewjXWwF784zrWjVpaEPtKA8X/flRQnbgkdYzD7wda9R+ceHft09INS2d4BXdKVqTRTlhiwTl0XgrVKaks6oqEmPam1bEmC0GTUcgZu5+/EuJ0yLCCmEJUUxpLWNGTtOSbJZ+Bckl9S8+2rZDoAOmJx/3rgmnSFIH5xV0kFS5JwWZUcCXvcscqjSJSHCwut4qUFXBGy2s2vuy6M6/tVjqtYvfJVO0lqqdNABanxzMmURODVEbjwwNdHZMPlpuQDMuAWEceEcpbsU7suKA4rKMmxscpHYuiMRofStlTZvZEC7Q3HKo4NU9AlCRVfG1zzxYLurFVmmedOqIcmq2SbD/338zcZ3ukGbJnN8y0z9tTLtBOWtZCBadONlo8GNI4uqB/So3soyuJxRM2aZ5JwhGIc9DdlGX6RJ9JK/GKPX0LNagezoV7toHq4UL83h3iK7xpQwR4KeurZUjdgY/vm7isc8P3UbOXWcUS/0PwBRnLnNUbYRye2KHuEC2pvg8NMND/NzcGCMMOhvNDgRsAH2z+9cPSz3EX2duSi3/M0Ms/CMiNbqJkI5FKA8L/336cHDgGFVKXj4TmmjCkJUZ1MB81/DNwZdDF0/roQPF/24YtvGmdq4Ql0KQz+8WgcejuLyRt8+pesnnn/b2r730MJq/4=

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

The exmaKeywordsRe regex is not allowing me to use valid strings as translations keys

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')

SSR custom directive not working with router-link.

vue & vue-i18n version

[email protected] (with [email protected])
[email protected]
[email protected]

Reproduction Link

Online Demo
Github Repo

Steps to reproduce

Open the online demo link:

  1. refresh without cache (command-shift-R on mac) and see that {{ $t('xxx') }} shows immediately (SSR) but v-t="'xxx'" shows a bit later (no SSR)
  2. Right-click and "View page source", and you can see this:
<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.

What is Expected?

v-t directive on <router-link> to work with SSR

What is actually happening?

v-t directive only works with primitive html elements, but not with vue components such as <router-link>.

Thank you so much!

SSR compatibility with Nuxt 3

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!

Action Required: Fix Renovate Configuration

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.

📢 Notice: transfer of repository

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. 😉

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.