<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Alexander</title>
    <description>The latest articles on DEV Community by Alexander (@alexanderlee).</description>
    <link>https://dev.to/alexanderlee</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1880080%2Fd8c0b160-ad53-4db7-bd34-262e04f5304a.jpg</url>
      <title>DEV Community: Alexander</title>
      <link>https://dev.to/alexanderlee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexanderlee"/>
    <language>en</language>
    <item>
      <title>Help! Problems with I18n into my project (Laravel + Vue.js)</title>
      <dc:creator>Alexander</dc:creator>
      <pubDate>Tue, 20 Aug 2024 12:37:04 +0000</pubDate>
      <link>https://dev.to/alexanderlee/help-problems-with-i18n-into-my-project-laravel-vuejs-1lff</link>
      <guid>https://dev.to/alexanderlee/help-problems-with-i18n-into-my-project-laravel-vuejs-1lff</guid>
      <description>&lt;p&gt;Hello, Everyone.&lt;br&gt;
I'm building web site by using Laravel and Vue.js.&lt;br&gt;
And here, I'm going to use I18n into my project but I had some problems.&lt;br&gt;
For use I18n,&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I installed vue-i18n into my project correctly.&lt;/li&gt;
&lt;li&gt;Then, created translation files such as en.json and fr.json.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz342fzyjy27cgcf9w17i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz342fzyjy27cgcf9w17i.png" alt="Image description" width="729" height="534"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Then, setted up vue-i18n configuration.
 Created an i18n setup file, (resources/js/i18n/index.js where I configure vue-i18n)&lt;/li&gt;
&lt;li&gt;Then, integrated 'vue-i18n' with Vue application.
This is app.js file.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;...
import { createApp, h } from "vue";
import { createInertiaApp } from "@inertiajs/vue3";
import { resolvePageComponent } from "laravel-vite-plugin/inertia-helpers";
import { ZiggyVue } from "../../vendor/tightenco/ziggy/dist/vue.m";
import i18n from "./i18n"; 

import plugins from "./plugins";

const appName = import.meta.env.VITE_APP_NAME || "Laravel";

createInertiaApp({
    title: (title) =&amp;gt; `${title} - ${appName}`,
    resolve: (name) =&amp;gt;
        resolvePageComponent(
            `./Pages/${name}.vue`,
            import.meta.glob("./Pages/**/*.vue")
        ),
    setup({ el, App, props, plugin }) {
        return createApp({ render: () =&amp;gt; h(App, props) })
            .use(plugin)
            .use(ZiggyVue)
            .use(i18n)
            .use(plugins)
            .mount(el);
    },
    progress: {
        color: "#4B5563",
    },
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Finally, I used translations in components.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But I had errors.(image)&lt;br&gt;
I think I made mistake into the integration of vue-i18n with Vue application.&lt;br&gt;
If you have experiences with such problem, help me, please.&lt;br&gt;
(This is my Code structure is following.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fakmgfh9iyuug901d5f61.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fakmgfh9iyuug901d5f61.png" alt="Image description" width="800" height="698"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And this is my error.&lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyq20xzbmd86mg7z8t7fc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyq20xzbmd86mg7z8t7fc.png" alt="Image description" width="642" height="362"&gt;&lt;/a&gt;&lt;br&gt;
)&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
