Valheim
You are viewing a potentially older version of this package. View Latest Version
Install with App

Details

Date Uploaded
Downloads
108
Size
13KB
ADDatHost Valheim hosting
30% off

Allspeak (Valheim client-side mod)

BepInEx plugin that detects the language of incoming chat messages and shows a translation in the chat panel. Messages already in the target language, or in a language you've marked as ignored, are left alone.

Behavior

  • Harmony postfix on Chat.OnNewChatMessage catches each incoming message.
  • One request to Google's unofficial clients5.google.com/translate_a/t?client=dict-chrome-ex endpoint detects the source language and translates in the same call.
  • If the detected language equals TargetLanguage or is in IgnoredLanguages, nothing is shown.
  • Otherwise a line like [de→en] Hello there is added via Chat.instance.AddString.
  • On world join, a test translation shows Allspeak is active in the target language (or Allspeak inactive, check logs on failure).
  • Runs as a Unity coroutine using UnityWebRequest (no threading issues).

Config (BepInEx/config/com.iyon.allspeak.cfg)

Created on first game launch. Editable in r2modman / Thunderstore Mod Manager (Config editor) or any text editor; restart game to apply.

Key Default Meaning
Enabled true Master switch
TargetLanguage auto Language to translate into. auto = game's UI language (fallback en). Otherwise a code from Supported languages, e.g. en, de, no, pt-PT, zh-TW
IgnoredLanguages (empty) Comma-separated codes you understand, e.g. de,fr. Messages detected as these aren't translated
SkipOwnMessages true Don't translate messages you send yourself

Supported languages

Google Translate target codes (249), from clients5.google.com/translate_a/l?client=dict-chrome-ex&hl=en (tl). Valid for TargetLanguage and IgnoredLanguages.

Code Language Code Language Code Language
ab Abkhaz iw Hebrew os Ossetian
ace Acehnese hil Hiligaynon pag Pangasinan
ach Acholi hi Hindi pap Papiamento
aa Afar hmn Hmong ps Pashto
af Afrikaans hu Hungarian fa Persian
sq Albanian hrx Hunsrik pl Polish
alz Alur iba Iban pt Portuguese (Brazil)
am Amharic is Icelandic pt-PT Portuguese (Portugal)
ar Arabic ig Igbo pa Punjabi (Gurmukhi)
hy Armenian ilo Ilocano pa-Arab Punjabi (Shahmukhi)
as Assamese id Indonesian qu Quechua
av Avar iu-Latn Inuktut (Latin) kek Qʼeqchiʼ
awa Awadhi iu Inuktut (Syllabics) rom Romani
ay Aymara ga Irish ro Romanian
az Azerbaijani it Italian rn Rundi
ban Balinese jam Jamaican Patois ru Russian
bal Baluchi ja Japanese se Sami (North)
bm Bambara jw Javanese sm Samoan
bci Baoulé kac Jingpo sg Sango
ba Bashkir kl Kalaallisut sa Sanskrit
eu Basque kn Kannada sat-Latn Santali (Latin)
btx Batak Karo kr Kanuri sat Santali (Ol Chiki)
bts Batak Simalungun pam Kapampangan gd Scots Gaelic
bbc Batak Toba kk Kazakh nso Sepedi
be Belarusian kha Khasi sr Serbian
bem Bemba km Khmer st Sesotho
bn Bengali cgg Kiga crs Seychellois Creole
bew Betawi kg Kikongo shn Shan
bho Bhojpuri rw Kinyarwanda sn Shona
bik Bikol ktu Kituba scn Sicilian
bs Bosnian trp Kokborok szl Silesian
br Breton kv Komi sd Sindhi
bg Bulgarian gom Konkani si Sinhala
bua Buryat ko Korean sk Slovak
yue Cantonese kri Krio sl Slovenian
ca Catalan ku Kurdish (Kurmanji) so Somali
ceb Cebuano ckb Kurdish (Sorani) es Spanish
ch Chamorro ky Kyrgyz su Sundanese
ce Chechen lo Lao sus Susu
ny Chichewa ltg Latgalian sw Swahili
zh-CN Chinese (Simplified) la Latin ss Swati
zh-TW Chinese (Traditional) lv Latvian sv Swedish
chk Chuukese lij Ligurian ty Tahitian
cv Chuvash li Limburgish tg Tajik
co Corsican ln Lingala ber-Latn Tamazight
crh Crimean Tatar (Cyrillic) lt Lithuanian ber Tamazight (Tifinagh)
crh-Latn Crimean Tatar (Latin) lmo Lombard ta Tamil
hr Croatian lg Luganda tt Tatar
cs Czech luo Luo te Telugu
da Danish lb Luxembourgish tet Tetum
fa-AF Dari mk Macedonian th Thai
dv Dhivehi mad Madurese bo Tibetan
din Dinka mai Maithili ti Tigrinya
doi Dogri mak Makassar tiv Tiv
dov Dombe mg Malagasy tpi Tok Pisin
nl Dutch ms Malay to Tongan
dyu Dyula ms-Arab Malay (Jawi) lua Tshiluba
dz Dzongkha ml Malayalam ts Tsonga
en English mt Maltese tn Tswana
eo Esperanto mam Mam tcy Tulu
et Estonian gv Manx tum Tumbuka
ee Ewe mi Maori tr Turkish
fo Faroese mr Marathi tk Turkmen
fj Fijian mh Marshallese tyv Tuvan
tl Filipino mwr Marwadi ak Twi
fi Finnish mfe Mauritian Creole udm Udmurt
fon Fon chm Meadow Mari uk Ukrainian
fr French mni-Mtei Meiteilon (Manipuri) ur Urdu
fr-CA French (Canada) min Minang ug Uyghur
fy Frisian lus Mizo uz Uzbek
fur Friulian mn Mongolian ve Venda
ff Fulani my Myanmar (Burmese) vec Venetian
gaa Ga bm-Nkoo NKo vi Vietnamese
gl Galician nhe Nahuatl (Eastern Huasteca) war Waray
ka Georgian ndc-ZW Ndau cy Welsh
de German nr Ndebele (South) wo Wolof
el Greek new Nepalbhasa (Newari) xh Xhosa
gn Guarani ne Nepali sah Yakut
gu Gujarati no Norwegian yi Yiddish
ht Haitian Creole nus Nuer yo Yoruba
cnh Hakha Chin oc Occitan yua Yucatec Maya
ha Hausa or Odia (Oriya) zap Zapotec
haw Hawaiian om Oromo zu Zulu

Dev setup

Develop on macOS, build + run on Windows.

Layout:

  • src/Allspeak.csproj — net48, SDK-style
  • src/Plugin.cs — entire plugin
  • lib/ — game DLLs for macOS builds (gitignored)
  • scripts/copy-libs.ps1 — collects game DLLs on Windows

Refs:

  • BepInEx.Core (incl. HarmonyX 0Harmony) — NuGet, BepInEx feed (NuGet.config)
  • assembly_valheim — publicized at build time via BepInEx.AssemblyPublicizer.MSBuild
  • assembly_guiutils (Localization) — publicized, from game
  • assembly_utils, UnityEngine* — from game valheim_Data/Managed/

macOS

  1. Install .NET SDK: brew install --cask dotnet-sdk
  2. On Windows: scripts\copy-libs.ps1, copy resulting lib\*.dll into lib/ here.
  3. dotnet build — compile check only.

Windows

  1. Install .NET SDK + BepInEx 5.4.x into Valheim.
  2. dotnet build — default Steam path auto-detected; else dotnet build -p:ValheimPath="D:\...\Valheim" (or env var ValheimPath).
  3. DLL auto-copied to Valheim\BepInEx\plugins\ when that folder exists.

Testing

Valheim has no native macOS build. Test on Windows (or a Windows VM) with BepInEx 5.4.x installed.

Known issues / TODO

  • Signature drift: Chat.OnNewChatMessage parameters change between game versions. Verify type, user, text in a decompiler (ILSpy / Rider).
  • Short messages ("gg", "lol") are often misdetected. Consider a minimum-length check.
  • Privacy / reliability: chat text is sent to Google; the free endpoint may rate-limit or change. Consider DeepL free API (returns detected_source_language) or self-hosted LibreTranslate.
  • Not covered: speech bubbles above players' heads are not translated, only the chat panel.
  • Possible additions: translation cache, per-player ignore list, hotkey toggle.
Thunderstore development is made possible with ads. Please consider making an exception to your adblock.