Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

171
Visualizações
How to change font-family when locale language changes in vuetify

I have and multi-language application and it will switch language via select input that toggle locale between 2 languages, on the other hand, I have 2 font-family that I want to toggle when the locale changed.


vuetify.js

    import Vue from 'vue';
    import Vuetify from 'vuetify';
    import 'vuetify/dist/vuetify.min.css';
    import fa from '../i18n/vuetify/fa.ts';
    import en from '../i18n/vuetify/en.ts';
    
    Vue.use(Vuetify);
    
    export default new Vuetify({
      rtl: true,
      lang: {
        locales: { fa, en },
        current: 'fa',
      },
    });

style.scss

    // my font-faces
    @import url('./fonts/gilroy/gilroy.css');
    @import url('./fonts/yekan/yekan.css');
    
    $font-family: 'YekanBakh'; //or Gilroy
    .v-application {
        font-family: $font-family, sans-serif !important;
        [class*='text-'] {
          font-family: $font-family, sans-serif !important;
        }
      }

LanguageSelector.vue

export default {
  data: () => ({
    languages: [
      {
        label: 'فـارسی',
        value: 'fa',
        icon: iranFlag,
      },
      {
        label: 'English',
        value: 'en',
        icon: ukFlag,
      },
    ],
    selectedLanguage: {
      label: 'فـارسی',
      value: 'fa',
      icon: iranFlag,
    },
  }),
  watch: {
    selectedLanguage(val) {
      this.$vuetify.lang.current = val;
      if (val === 'en') {
        this.$vuetify.rtl = false;
      } else {
        this.$vuetify.rtl = true;
      }
    },
  },
over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Although, there are different ways to achieve this, the logic is similar. You should have two separate files (e.g.: style.css and style.rtl.css) and with the getting help from your custom language service detect the direction of selected locale, after that apply corresponding style to your application. But, how we could achieve this target? It totally depends on your needs. You can do it manually or use something like this plugin.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda