intlify / routing Goto Github PK
View Code? Open in Web Editor NEWThe i18n routing libraries
License: MIT License
The i18n routing libraries
License: MIT License
Other Open Graph tags, like og:title
, og:description
, etc. can and should be added separately from i18n, but given the logic included in this package of turning localized routes into link
and meta
tags, it would be great to generate the og:url
metadata in additional to the already generated og:locale
ones, so that systems relying on Open Graph (e.g. Facebook scrapers) are satisfied.
In /src/compatibles/head.ts
, rewrite addCanonicalLinks
into addCanonicalLinksAndOgUrl
addOgUrl
function, but most of the logic / intermediate steps would be the same as addCanonicalLinks
addOgUrl: boolean
to maximize flexibility: thought it wasn't necessary
See https://developers.facebook.com/docs/sharing/webmasters/#basic
This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.
These updates are currently rate-limited. Click on a checkbox below to force their creation now.
@typescript-eslint/eslint-plugin
, @typescript-eslint/parser
)vue
, vue2
)These updates have all been created already. Click a checkbox below to force a retry/rebase of any.
@vue/runtime-dom
, vue
, vue-template-compiler
, vue2
).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/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 v4
package.json
@intlify/eslint-plugin-vue-i18n ^2.0.0
@types/js-yaml ^4.0.5
@types/node ^18.17.4
@typescript-eslint/eslint-plugin ^6.3.0
@typescript-eslint/parser ^6.3.0
bumpp ^9.1.1
cross-env ^7.0.3
eslint ^8.47.0
eslint-config-prettier ^9.0.0
eslint-import-resolver-alias ^1.1.2
eslint-import-resolver-typescript ^3.6.0
eslint-plugin-import ^2.28.0
eslint-plugin-prettier ^5.0.0
eslint-plugin-tsdoc ^0.2.17
eslint-plugin-vue ^9.17.0
globby ^13.0.0
happy-dom ^6.0.4
jiti ^1.19.1
js-yaml ^4.1.0
lint-staged ^15.0.0
npm-run-all ^4.1.5
pathe ^1.1.1
pkg-types ^1.0.3
prettier ^3.0.1
rimraf ^3.0.2
typescript ^5.1.6
vue-eslint-parser ^9.3.1
node >= 14.6
packages/vue-i18n-routing/package.json
@intlify/shared ^9.4.1
@intlify/vue-i18n-bridge ^1.1.0
@intlify/vue-router-bridge ^1.1.0
ufo ^1.2.0
vue-demi >=0.13.5 < 1.0.0
@microsoft/api-extractor ^7.31.1
api-docs-gen ^0.4.0
typescript ^5.1.6
vite ^4.4.9
vite-plugin-dts ^3.5.1
vitest ^0.34.1
vue ^3.2.27
vue-i18n 9.4.0
vue-i18n-legacy 8
vue-router ^4.1.5
vue-router3 3.6.5
vue-template-compiler ^2.6.14
vue2 2.6.14
@vue/composition-api ^1.0.0-rc.1
vue ^2.6.14 || ^2.7.0 || ^3.2.0
vue-i18n ^8.26.1 || >=9.2.0
vue-i18n-bridge >=9.2.0
vue-router ^3.5.3 || ^3.6.0 || ^4.0.0
node >= 14.6
playground/vue2-options/package.json
@vue/composition-api ^1.7.0
vue 2.6.14
vue-router 3.5.3
vue-i18n ^8
vue-i18n-bridge ^9.3.0
vue-i18n-routing 0.13.4
@types/node ^18.0.4
@vitejs/plugin-legacy 1.8.2
@vue/runtime-dom 3.2.31
typescript ^4.7.4
unplugin-vue2-script-setup 0.11.4
vite 2.9.18
playwright 1.25.2
vite-test-utils 0.6.0
vitest ^0.34.0
vite-plugin-vue2 2.0.3
vue-template-compiler 2.6.14
vue-tsc 0.40.13
playground/vue2/package.json
@vue/composition-api ^1.7.0
vue 2.6.14
vue-router 3.5.3
vue-i18n ^8
vue-i18n-bridge ^9.3.0
vue-i18n-routing 0.13.4
@types/node ^18.0.4
@vitejs/plugin-legacy 1.8.2
@vue/runtime-dom 3.2.31
typescript ^4.7.4
unplugin-vue2-script-setup 0.11.4
vite 2.9.18
playwright 1.25.2
vite-test-utils 0.6.0
vitest ^0.34.0
vite-plugin-vue2 2.0.3
vue-template-compiler 2.6.14
vue-tsc 0.40.13
playground/vue3-options/package.json
vue 3.2.31
vue-router 4.1.2
vue-i18n ^9.3.0
@vueuse/head 0.9.8
vue-i18n-routing 0.13.4
@types/node ^18.0.4
@vitejs/plugin-vue 3.2.0
@vitejs/plugin-vue-jsx 2.1.1
@vue/tsconfig 0.1.3
typescript ^4.8.3
vite 3.2.10
playwright 1.25.2
vite-test-utils 0.6.0
vitest ^0.34.0
vue-tsc 0.40.13
playground/vue3/package.json
vue 3.2.31
vue-router 4.1.2
vue-i18n ^9.3.0
@vueuse/head 0.9.8
vue-i18n-routing 0.13.4
@types/node ^18.0.4
@vitejs/plugin-vue 3.2.0
@vitejs/plugin-vue-jsx 2.1.1
@vue/tsconfig 0.1.3
typescript ^4.8.3
vite 3.2.10
playwright 1.25.2
vite-test-utils 0.6.0
vitest ^0.34.0
vue-tsc 0.40.13
Hi! I need to pass props to a route, but to do it I need to use the name of the route, and the library modifies it.
I tried to use localeLocation, and when running it inside a template it works correctly.
My problem is that I need it to work inside the script block (I'm using vue3 with composition api, and the script setup syntax).
When using the function localeLocation inside the script, it tells me that it does not exist, when importing it (which I do not need to do when using it inside the template) and running the function it returns me that it cant find 'router', but I can not pass it to the function.
What can I do to be able to use parameters with this library?
My project is configured like the playground vue3 project
<script setup lang="ts">
// Does not work
console.log(localeLocation({ name: 'about', params: { test: 'hola' } } ))
</script>
<template>
<!-- Does work -->
<pre>{{ localeLocation({ name: 'about', params: { test: 'hola' } }) }}</pre>
</template>
Not Found - GET https://registry.npmjs.org/vue-i18n-switch - Not found
When mounting a component that uses useRoute()
or useRouter()
with vue-test-utils
and a vue-i18n-router
, the useRoute
and useRouter
composables do not return any values. Instead the following error will be printed:
[Vue warn]: injection "Symbol(route location)" not found.
at <HelloWorld ref="VTU_COMPONENT" >
at <VTUROOT>
When using a vue-router
instead of the vue-i18n-router
everything is working as expected.
https://stackblitz.com/edit/vitejs-vite-vckr8m?file=tests%2FSample.spec.js
System:
OS: Linux 5.0 undefined
CPU: (2) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 18.18.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 10.2.3 - /usr/local/bin/npm
pnpm: 8.15.3 - /usr/local/bin/pnpm
npm
No response
I'm on Vue 3, and require vue-i18n-routing
0.7.0
in my package.json
.
When I run pnpm i --no-optional
, I get the following error message:
Cannot reproduce on stackblitz, please advice.
System:
OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
Memory: 46.74 GB / 62.74 GB
Container: Yes
Shell: 5.8.1 - /usr/bin/zsh
Binaries:
Node: 18.11.0 - ~/.nvm/versions/node/v18.11.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v18.11.0/bin/npm
Browsers:
Firefox: 106.0
.npmrc
audit=false
engine-strict=true
loglevel=error
fund=false
node-linker=hoisted
prefer-offline=true
progress=false
shamefully-hoist=true
store-dir=.pnpm-store
strict-peer-dependencies=true
update-notifier=false
I'm using a modified version of nuxt-seo-kit
and I'm using it's breadcrumbs
I have modified it to include or omit language codes in the breadcrumb it creates
the problem is, on main page, I have to have a way to detect and omit the default locale's language code for the main page, since default language does not include language code in it's url
currently there's no way to get the defaultLocale set in the config that I'm aware of, cleanly (without using some env variable)
expose it using a composable ? I'm not sure what's the best way to expose it.
the alternative is to simply use runtime config
it won't be clean and it can't be included in a PR for nuxt-seo-kit
No response
When utilizing the localePath
function by passing a string with a route containing query parameters, such as /some-route?foo=bar
, the query parameters are unexpectedly removed. This behavior occurs only when the route exists.
const path = '/some-route?foo=bar';
const route = localePath(path);
// The expected output should include the query parameters, but they are omitted.
// Result: "/en/some-route"
Upon investigation, the query parameters removal occurs in the vue-i18n-routing/src/compatibles/routing.ts file, specifically in the following code snippet:
// vue-i18n-routing/src/compatibles/routing.ts line 232
const resolvedRoute = router.resolve(localizedRoute) as any
At this point, the localizedRoute is in the format:
{
path: "/en/some-route?foo=bar",
}
As a result, the query parameters are inadvertently removed from the route.
An observation has been made that the behavior of the router.resolve() function differs when a string is passed versus when an object with a path property is passed. The former retains the query parameters, while the latter removes them.
const router = useRouter()
const path = '/en/some-route?foo=bar'
const routeResolvedFromString = router.resolve(path)
// returns {
// "fullPath": "/en/some-route?foo=bar",
// "path": "/en/some-route",
// "query": { "foo": "bar" },
// ...
// }
const routeResolvedFromObject = router.resolve({ path })
{
"fullPath": "/en/some-route",
"path": "/en/some-route",
"query": {},
...
}
It's unclear whether this behavior is rooted in the vue-router library, but this information could potentially offer a workaround to mitigate the issue.
https://stackblitz.com/edit/nuxt-starter-vbbhvz?file=pages%2Findex.vue
System:
OS: macOS 13.5
CPU: (8) arm64 Apple M1
Memory: 101.73 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 16.20.1 - /usr/local/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 9.6.7 - /opt/homebrew/bin/npm
pnpm: 7.30.0 - /opt/homebrew/bin/pnpm
Browsers:
Chrome: 113.0.5672.126
Safari: 16.6
Safari Technology Preview: 17.0
yarn
Problem first noticed in Nuxt 3.5.3 with @nuxtjs/i18n 8.0.0-rc.2 with this configuration:
i18n: {
locales: [
{
code: 'fr',
name: 'Français',
iso: 'fr-BE',
},
{
code: 'en',
name: 'English',
iso: 'en-US',
},
],
defaultLocale: 'fr',
strategy: 'prefix',
dynamicRouteParams: true,
},
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.