question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't seem to get trans to work

See original GitHub issue

I’m using Vue 3 with composition API and while $t and $tChoice both function perfectly, I can’t seem to get trans or transChoice to function properly. It’s as if it’s using a different configuration from $t and $tChoice. Thus no language strings are loaded.

It may just be a case of me doing something very wrong, as I work with Vue 2 daily and this is my first Vue 3 Composition API project.

Just in case it's important, here's the app.js file that I use
require('./bootstrap');

import { createApp, h } from 'vue';
import { createInertiaApp } from '@inertiajs/inertia-vue3';
import { InertiaProgress } from '@inertiajs/progress';
import { i18nVue } from 'laravel-vue-i18n';

const appName = window.document.getElementsByTagName('title')[0]?.innerText || 'Laravel';

createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => require(`./Pages/${name}.vue`),
    setup({ el, app, props, plugin }) {
        return createApp({ render: () => h(app, props) })
            .use(plugin)
            .use(i18nVue, {
              resolve: lang => import (`../lang/${lang}.json`),
            })
            .mixin({ methods: { route } })
            .mount(el);
    },
});

InertiaProgress.init({ color: '#4B5563' });

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:41 (22 by maintainers)

github_iconTop GitHub Comments

2reactions
alkrauss48commented, Mar 21, 2022

The tl;dr that worked for me after going through this thread is to change your trans function calls to wTrans:

import { wTrans } from 'laravel-vue-i18n';

getPassword() {
	return {
		required: helpers.withMessage(
			wTrans('Password is required.'),
			required,
		),
.
.
.
2reactions
xiCO2kcommented, Feb 22, 2022

Thanks for the help debugging @A-Ghorab 💪.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Being transgender at work - McKinsey
Although corporate America has stepped up its public support of LGBTQ rights, it still has a long road ahead to foster a truly...
Read more >
4 Ways To Make Your Workplace Equitable For Trans People
No matter where you work, being openly trans on the job can be tough — and it's simply not safe for many trans...
Read more >
I Think I Might Be Transgender, Now What Do I Do ... - CT.gov
Transgender people also include those who identify as “genderqueer,” gender neutral, and/or gender-free—people who may not identify as either male or female.
Read more >
The truth about trans - Stonewall
Can you be trans and gay? So, could a lesbian have a trans woman as a lesbian partner, or a gay man be...
Read more >
Finding Jobs and Finding Justice for Trans Workers
As a transgender woman, Hoole had dealt with discrimination before, and she was not the only one to face that struggle. The US...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found