Jet
BuyFollow on X
  • Home
  • Satisfied Requirements
  • License
  • Architecture
    • Overview
    • Internal Dependency Graph
    • External Dependencies
    • Conventions
  • Recipes
    • Get Started
    • Add a Page
    • Customise Fonts
    • Customise Icons
    • Customise Languages
    • Customise Themes
    • Add an Environment Variable
  • Classes
    • Jet Mat Paginator Intl
    • Transloco HTTP Loader
  • Components
    • App Component
    • Footer Component
    • Home Page Component
    • Message Page Component
    • Not Found Page Component
    • Page Component
    • Profile Page Component
    • Reset Password Page Component
    • Settings Page Component
    • Sign In Page Component
    • Sign Out Page Component
    • Sign Up Page Component
    • Update Password Page Component
  • Constants
    • Color Scheme Options
    • Default Color Scheme Option
    • Default Language Option
    • Default Settings
    • Language Options
    • Navigation Menu Items
  • Directives
    • Analytics Directive
  • Enums
    • Bucket
    • LocalStorage Key
    • Query Param
    • SessionStorage Key
    • Table
  • Guards
    • Is Authenticated
    • Is Not Authenticated
  • Interfaces
    • Color Scheme Option
    • Language Option
    • Navigation Menu Item
    • Profile
    • Progress Bar Configuration
    • Settings
  • Services
    • Alert Service
    • Analytics Service
    • Logger Service
    • Profile Service
    • Progress Bar Service
    • Service Worker Service
    • Settings Service
    • Storage Service
    • Supabase Service
    • Toolbar Title Service
    • User Service
  • Types
    • Available Color Scheme
    • Available Font
    • Available Language
    • Available OAuth Provider
Powered by GitBook
On this page

Was this helpful?

  1. Recipes

Customise Languages

PreviousCustomise IconsNextCustomise Themes

Last updated 8 months ago

Was this helpful?

Let's add Hindi.

Step 1: Update transloco.config.js to add hi.

transloco.config.js
module.exports = {
  rootTranslationsPath: '../public/i18n/',
  langs: ['ar', 'en', 'hi'],
  keysManager: {
    output: '../public/i18n/',
    sort: true,
    unflat: true,
  },
};

Step 2: Update the type.

available-language.type.ts
export type AvailableLanguage = 'ar' | 'en' | 'hi';

Step 3: Update the Language Options constant.

language-options.constant.ts
export const LANGUAGE_OPTIONS: LanguageOption[] = [
  {
    directionality: 'ltr',
    font: 'noto-sans',
    icon: 'translate',
    nameKey: 'english',
    value: 'en',
  },
  {
    directionality: 'rtl',
    font: 'noto-sans-arabic',
    icon: 'translate',
    nameKey: 'arabic',
    value: 'ar',
  },
  {
    directionality: 'ltr',
    font: 'noto-sans',
    icon: 'translate',
    nameKey: 'hindi',
    value: 'hi',
  },
];

Step 4: Update the dynamic keys comment in the Settings Page Component.

settings-page.component.ts
/**
 * Dynamic keys to include in translations (https://github.com/jsverse/transloco-keys-manager?tab=readme-ov-file#dynamic-keys):
 *
 * t(jet-settings-page.arabic)
 * t(jet-settings-page.english)
 * t(jet-settings-page.hindi)
 */

Step 5: Run the i18n:extract script in package.json. This will add the missing keys and generate hi.json in /public/i18n/.

Step 6: Update the values in hi.json. Ensure the variables in dynamic translations are retained.

Done!

Available Language
Jet in custom language
Jet in custom language