<?xml version="1.0" encoding="utf-8" ?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:tt="http://teletype.in/" xmlns:opensearch="http://a9.com/-/spec/opensearch/1.1/"><title>Frontend</title><subtitle>📚 Qulay formatdagi ma'lumotlar</subtitle><author><name>Frontend</name></author><id>https://teletype.in/atom/frontendchi</id><link rel="self" type="application/atom+xml" href="https://teletype.in/atom/frontendchi?offset=0"></link><link rel="alternate" type="text/html" href="https://teletype.in/@frontendchi?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=frontendchi"></link><link rel="next" type="application/rss+xml" href="https://teletype.in/atom/frontendchi?offset=10"></link><link rel="search" type="application/opensearchdescription+xml" title="Teletype" href="https://teletype.in/opensearch.xml"></link><updated>2026-05-24T02:14:46.846Z</updated><entry><id>frontendchi:vue-i18n</id><link rel="alternate" type="text/html" href="https://teletype.in/@frontendchi/vue-i18n?utm_source=teletype&amp;utm_medium=feed_atom&amp;utm_campaign=frontendchi"></link><title>Vue 3 loyihasiga xalqaro tillarni qo'shish (vue-i18n)</title><published>2024-05-20T19:01:51.144Z</published><updated>2024-05-20T19:32:14.140Z</updated><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img2.teletype.in/files/9f/fa/9ffa9f61-42e5-4c8a-ad88-b1864d3baef3.png"></media:thumbnail><summary type="html">&lt;img src=&quot;https://img3.teletype.in/files/ee/a7/eea7423c-96c5-4e06-a3aa-287d808b3af1.png&quot;&gt;Bugungi kunda web-ilovalar global foydalanuvchilar uchun mo'ljallangan bo'lib, turli tillardagi qo'llab-quvvatlash juda muhim ahamiyatga ega. Vue 3 ilovangizga xalqaro tillarni qo'shish orqali siz kengroq auditoriyaga xizmat qilishingiz mumkin. Bu jarayonni &quot;Vue I18n&quot; yordamida oson amalga oshirish mumkin.</summary><content type="html">
  &lt;figure id=&quot;oDC3&quot; class=&quot;m_column&quot;&gt;
    &lt;img src=&quot;https://img3.teletype.in/files/ee/a7/eea7423c-96c5-4e06-a3aa-287d808b3af1.png&quot; width=&quot;2960&quot; /&gt;
  &lt;/figure&gt;
  &lt;p id=&quot;rzWU&quot;&gt;Bugungi kunda web-ilovalar global foydalanuvchilar uchun mo&amp;#x27;ljallangan bo&amp;#x27;lib, turli tillardagi qo&amp;#x27;llab-quvvatlash juda muhim ahamiyatga ega. Vue 3 ilovangizga xalqaro tillarni qo&amp;#x27;shish orqali siz kengroq auditoriyaga xizmat qilishingiz mumkin. Bu jarayonni &amp;quot;Vue I18n&amp;quot; yordamida oson amalga oshirish mumkin.&lt;/p&gt;
  &lt;p id=&quot;GoRt&quot;&gt;Quyida loyihangizni ko&amp;#x27;p tilli qilishni ko&amp;#x27;rib chiqamiz.&lt;br /&gt;&lt;/p&gt;
  &lt;h3 id=&quot;Znea&quot;&gt;I18n nima?&lt;/h3&gt;
  &lt;blockquote id=&quot;3OK5&quot;&gt;I18n - dasturiy ta&amp;#x27;minotni global tillarga moslashtirish uchun framework. Bu atama &amp;quot;internationalization&amp;quot; so&amp;#x27;zining qisqartmasi bo&amp;#x27;lib, &amp;quot;i&amp;quot; harfidan boshlanib, &amp;quot;n&amp;quot; harfigacha bo&amp;#x27;lgan oraliqda 18 ta harf borligi uchun &amp;quot;i18n&amp;quot; deb yuritiladi.&lt;/blockquote&gt;
  &lt;p id=&quot;JRqS&quot;&gt;&lt;/p&gt;
  &lt;p id=&quot;US26&quot;&gt;Vue loyihasiga I18n qo&amp;#x27;shish ketma-ketliklari:&lt;/p&gt;
  &lt;h4 id=&quot;Gnt3&quot;&gt;O&amp;#x27;rnatish&lt;/h4&gt;
  &lt;p id=&quot;XWYH&quot;&gt;Loyihangizga &lt;code&gt;vue-i18n@next&lt;/code&gt; paketini o&amp;#x27;rnatishingiz kerak:&lt;/p&gt;
  &lt;pre id=&quot;dQxQ&quot;&gt;npm install vue-i18n@9&lt;/pre&gt;
  &lt;p id=&quot;2wqs&quot;&gt;yoki&lt;/p&gt;
  &lt;pre id=&quot;Hpw5&quot;&gt;yarn add vue-i18n@9&lt;/pre&gt;
  &lt;h4 id=&quot;hmBr&quot;&gt;Konfiguratsiya&lt;/h4&gt;
  &lt;p id=&quot;EWnK&quot;&gt;&lt;code&gt;src&lt;/code&gt; papkasi ichida &lt;code&gt;i18n.js&lt;/code&gt; faylini yaratib, quyidagi kodni kiratamiz va sozlab olamiz:&lt;/p&gt;
  &lt;pre id=&quot;KBlv&quot;&gt;import { createI18n } from &amp;#x27;vue-i18n&amp;#x27;;

const messages = {
  en: {
    message: {
      hello: &amp;#x27;Hello world&amp;#x27;
    }
  },
  uz: {
    message: {
      hello: &amp;#x27;Salom dunyo&amp;#x27;
    }
  }
};

const i18n = createI18n({
  legacy: false,
  locale: &amp;#x27;uz&amp;#x27;, // asosiy til
  fallbackLocale: &amp;#x27;en&amp;#x27;, // zaxira tili
  messages,
});

export default i18n;&lt;/pre&gt;
  &lt;h4 id=&quot;2n58&quot;&gt;Asosiy faylda i18n qo&amp;#x27;llash&lt;/h4&gt;
  &lt;p id=&quot;smjb&quot;&gt;&lt;code&gt;main.js&lt;/code&gt; fayliga &lt;code&gt;i18n&lt;/code&gt; ob&amp;#x27;ektini qo&amp;#x27;shamiz:&lt;/p&gt;
  &lt;pre id=&quot;IHGy&quot;&gt;import { createApp } from &amp;#x27;vue&amp;#x27;;
import App from &amp;#x27;./App.vue&amp;#x27;;
import i18n from &amp;#x27;./i18n&amp;#x27;;

createApp(App).use(i18n).mount(&amp;#x27;#app&amp;#x27;);&lt;/pre&gt;
  &lt;h4 id=&quot;LuNs&quot;&gt;Foydalanish&lt;/h4&gt;
  &lt;pre id=&quot;afWj&quot;&gt;&amp;lt;template&amp;gt;
  &amp;lt;h1&amp;gt;{{ $t(&amp;#x27;message.hello&amp;#x27;) }}&amp;lt;/h1&amp;gt;
&amp;lt;/template&amp;gt;&lt;/pre&gt;
  &lt;pre id=&quot;oMxW&quot;&gt;&amp;lt;h1&amp;gt;Salom dunyo&amp;lt;/h1&amp;gt;&lt;/pre&gt;
  &lt;p id=&quot;fnSl&quot;&gt;Tilni o&amp;#x27;zgartirish&lt;/p&gt;
  &lt;pre id=&quot;TvPC&quot;&gt;&amp;lt;template&amp;gt;
  &amp;lt;button @click=&amp;quot;changeLanguage(&amp;#x27;uz&amp;#x27;)&amp;quot;&amp;gt;UZ&amp;lt;/button&amp;gt;
  &amp;lt;button @click=&amp;quot;changeLanguage(&amp;#x27;en&amp;#x27;)&amp;quot;&amp;gt;EN&amp;lt;/button&amp;gt;
&amp;lt;/template&amp;gt;
&amp;lt;script setup&amp;gt;

import { useI18n } from &amp;#x27;vue-i18n&amp;#x27;;
const { locale } = useI18n();

function changeLanguage(lang) {
  locale.value = lang;
}

&amp;lt;/script&amp;gt;&lt;/pre&gt;
  &lt;p id=&quot;wm2x&quot;&gt;&lt;/p&gt;
  &lt;p id=&quot;PHrT&quot;&gt;🌐 Vue I18n - &lt;a href=&quot;https://vue-i18n.intlify.dev/&quot; target=&quot;_blank&quot;&gt;https://vue-i18n.intlify.dev/&lt;/a&gt;&lt;/p&gt;
  &lt;p id=&quot;1yGi&quot;&gt;// Maqolada kamchiliklar bo’lishi mumkin. Hech kim xatoliklardan holi emas. Rahmat )&lt;br /&gt;&lt;/p&gt;

</content></entry></feed>