Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Langgenius Dify I18n Languages

From Leeroopedia
Knowledge Sources
Domains Frontend, Internationalization
Last Updated 2026-02-12 07:00 GMT

Overview

Static language catalog defining all locales available in the Dify frontend, including their display names, prompt names, example strings, and support status.

Description

This module exports a const-asserted data object containing an array of all language definitions recognized by the Dify platform. Each entry in the languages array describes a single locale with four properties:

  • value -- The BCP 47-style locale tag (e.g., 'en-US', 'zh-Hans', 'ja-JP'). This value is used as the canonical locale identifier throughout the application.
  • name -- The human-readable display name of the language, typically in its own script (e.g., '简体中文', '日本語 (日本)').
  • prompt_name -- An English label used when referencing the language in LLM prompts (e.g., 'Chinese Simplified', 'Japanese').
  • example -- A short example greeting string in the target language, used for UI previews.
  • supported -- A boolean flag indicating whether this locale is actively supported. Only locales with supported: true are included in the application's locale picker.

The object is exported with as const, which means TypeScript infers literal types for all values, enabling type-safe locale handling throughout the codebase. The module currently defines 23 languages, all marked as supported.

Usage

Use this module as the single source of truth for the list of languages in the Dify frontend. It is imported by language.ts to derive the LanguagesSupported array and the Locale type. When adding a new language to Dify, a new entry should be appended to this array.

Code Reference

Source Location

Signature

const data: {
  languages: readonly [
    {
      value: 'en-US'
      name: 'English (United States)'
      prompt_name: 'English'
      example: 'Hello, Dify!'
      supported: true
    },
    // ... 22 more entries
  ]
}

export default data

Import

import data from '@/i18n-config/languages'

// Access the languages array
const languages = data.languages

I/O Contract

Inputs

Name Type Required Description
(none) -- -- This module has no function inputs; it exports a static data constant.

Outputs

Name Type Description
data.languages readonly Array<{ value: string; name: string; prompt_name: string; example: string; supported: boolean }> An immutable array of language definition objects.

Supported Languages

The following table lists all 23 languages defined in the module:

Locale Code Display Name Prompt Name Example
en-US English (United States) English Hello, Dify!
zh-Hans 简体中文 Chinese Simplified 你好,Dify!
zh-Hant 繁體中文 Chinese Traditional 你好,Dify!
pt-BR Portugues (Brasil) Portuguese Ola, Dify!
es-ES Espanol (Espana) Spanish Hola, Dify!
fr-FR Francais (France) French Bonjour, Dify!
de-DE Deutsch (Deutschland) German Hallo, Dify!
ja-JP 日本語 (日本) Japanese こんにちは、Dify!
ko-KR 한국어 (대한민국) Korean 안녕하세요, Dify!
ru-RU Русский (Россия) Russian Привет, Dify!
it-IT Italiano (Italia) Italian Ciao, Dify!
th-TH ไทย (ประเทศไทย) Thai สวัสดี Dify!
uk-UA Українська (Україна) Ukrainian Привет, Dify!
vi-VN Tieng Viet (Viet Nam) Vietnamese Xin chao, Dify!
ro-RO Romana (Romania) Romanian Salut, Dify!
pl-PL Polski (Polish) Polish Czesc, Dify!
hi-IN Hindi (India) Hindi Namaste, Dify!
tr-TR Turkce Turkce Selam!
fa-IR Farsi (Iran) Farsi سلام, دیفای!
sl-SI Slovensko (Slovenija) Slovensko Zdravo, Dify!
id-ID Bahasa Indonesia Indonesian Halo, Dify!
nl-NL Nederlands (Nederland) Dutch Hallo, Dify!
ar-TN العربية (تونس) Tunisian Arabic مرحبا، Dify!

Usage Examples

Iterating Over All Supported Languages

import data from '@/i18n-config/languages'

const supportedLanguages = data.languages.filter(lang => lang.supported)
supportedLanguages.forEach(lang => {
  console.log(`${lang.name} (${lang.value}): ${lang.example}`)
})

Accessing a Specific Language Entry

import data from '@/i18n-config/languages'

// Find Japanese entry
const japanese = data.languages.find(lang => lang.value === 'ja-JP')
console.log(japanese?.prompt_name) // 'Japanese'

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment