跳到主要内容

Translation Config

Configure the multi-language translation system

Main configuration entry for the translation system. Configure languages, settings, and behaviours here. Available Placeholders: - %typewriter_translate_<key>% — Get translation by key - %typewriter_translate_lang% — Player's current language name - %typewriter_translate_lang_display% — Language display name - %typewriter_translate_lang_flag% — Language flag code - %typewriter_translate_count% — Total translation count

字段

字段类型默认值描述
languagesList<LanguageConfig>—List of languages available for translation. Each language requires a unique name (e.g., 'en_GB', 'fr_FR').
LanguageConfig(5)
字段类型默认值描述
flagString—Banner flag code from https://www.needcoolshoes.com/banner Create a flag, then copy the code after 'banner?=' in the URL. Example: 'eapwplpnpmbzbj' for UK flag
minecraftCodesList<String>emptyMinecraft locale codes that map to this language. Players with these client locales will be assigned this language. Example: ['en_GB', 'en_US', 'en_AU']
displayNameString—Display name shown in the language selector. Supports color codes with '&'. Example: '&3English (UK)'占位符
fallbackLanguagesList<String>emptyLanguages to try if a translation is missing in this language. Falls back in order, then to main language.
onChangeActionsList<Ref<TriggerableEntry>>emptyTypeWriter actions to execute when a player switches to this language. Use this to send welcome messages, play sounds, etc.
mainLanguageStringen_GBThe default language used when a player's language is not found or as fallback
runLanguageActionsOnJoinBooleanfalseExecute language change actions when a player joins the server
forceClientLocaleOnJoinBooleanfalseAutomatically set player's language based on their Minecraft client locale. Only applied on first join if no language is saved.
translationsFolderStringTranslateFolder name for translation files (relative to TypeWriter data folder). Translation JSON files should be placed in this folder.
logLevelInt0Log level for debugging (0-3): 0 = Errors only 1 = Info + translation counts 2 = Debug + file loading details 3 = Trace + every translation lookup
aiTranslationAITranslationConfig—AI Translation configuration
AITranslationConfig(10)
字段类型默认值描述
enabledBooleanfalseEnable AI-powered automatic translation for chat
providerAIProviderOPENROUTERTranslation backend. Picking one fills in its own base URL and model, so a key is usually the only thing left to set. OpenAI-compatible chat APIs: OPENROUTER, OPENAI, DEEPSEEK, GROQ, MISTRAL, OLLAMA, OPENAI_COMPATIBLE (any other server — set apiBaseUrl and model yourself). Own API shapes: ANTHROPIC, GEMINI. Dedicated translation engines (no LLM): LIBRETRANSLATE (self-hostable), DEEPL.可选值:OPENROUTEROPENAI
apiKeyString—API Key for the selected provider. Use 'env:VAR_NAME' to read it from an environment variable instead of storing it in clear text.
modelString—Model id. Leave empty to use the provider's default. Ignored by LibreTranslate and DeepL.
apiBaseUrlString—Base API URL. Leave empty to use the provider's default; required for OPENAI_COMPATIBLE and self-hosted LibreTranslate.
systemPromptStringYou are a professional Minecraft translator. Translate the message into the target language. Keep the original style and formatting. Only return the translated text.System prompt to guide the AI translator
noTranslateRegexList<String>—List of regex patterns. Messages matching any of these will NOT be translated.
censorRegexList<String>emptyList of regex patterns. Matching words will be replaced with '***' before translation.
enabledSectionsList<String>—Sections where translation is enabled (e.g. ['CHAT'])
chatTranslationTimeoutMsLong800Max time (ms) chat delivery waits for AI translations before rendering untranslated. A slow AI provider blocks every viewer's chat for up to this long, so keep it short.
openSelectorCommandOverrideString—Custom command to run when a player opens the language selector. If set, this command will be executed instead of opening the GUI menu. Use {player} as placeholder for the player name.
languageMenuRef<OpenGuiActionEntry>—Page-declared menu opened by /translate menu and by the 'open language selector' action. Build it as a normal open_gui menu and place the `translate_button:LANGUAGE#<n>` markers.
languageMenuViewIdString—View of 'languageMenu' to land on. Empty = the menu's default view.
settingsMenuRef<OpenGuiActionEntry>—Page-declared menu opened by the 'open translation settings' action. Place the `translate_button:TOGGLE_CHAT` and `translate_button:TOGGLE_SIGN` markers on it.
settingsMenuViewIdString—View of 'settingsMenu' to land on. Empty = the menu's default view.

How to use it​

Create one of these. The extension uses the first Translation Config it finds.

  • languages — one item per language. name is the code used in the JSON files and by /translate <name>, so it must match exactly (comparisons in files are case-insensitive, in the command they are not). flag is a banner code from needcoolshoes.com/banner, kept for menus and <translate_lang_flag>. displayName accepts & color codes. minecraftCodes lists the client locales that map to this language. fallbackLanguages are tried in order before mainLanguage. onChangeActions run each time a player switches to this language, whatever the way (command, menu, action).
  • runLanguageActionsOnJoin runs the onChangeActions of the player's language at each join.
  • forceClientLocaleOnJoin switches the player when their client reports a matching locale change.
  • translationsFolder is relative to plugins/Typewriter/.
  • logLevel is documented in the field help (0 to 3), but the value is not read by the current code.
  • languageMenu and settingsMenu point to GUI menu entries; see the extension page for the button types.