If you are installing Ziggy and using the provided @routes blade directive, then the route function is ~~added to the window object~~ (wrong as of this writing).
EDIT: Actually it is declared as a global function, but declaring functions on the global scope in JavaScript actually adds it to the global object, which in a browser is the window object.
You can try this by opening your developer tools and calling route() from there.
In a browser the only way to have global function available everywhere is like this, adding it to the window object (or to globalThis, which in a browser translates to the window object).
You can do the same, although I don't recommend it to avoid crowding the global/window object, or to avoid risking having your global helper function overridden by another script that runs after yours and creates a global function named the same.
But if you really want, you just have to do something like this:
import { usePage } from '@inertiajs/inertia-vue3'
export default {
install: (app) => {
// assign both to app and to window
window.__t = app.config.globalProperties.__t = (key, replacements = {}) => {
// ...
What I would recommend is either importing manually (I actually prefer this for better three-shaking when compiling), or as you already figured out, using provide/inject.