Skip to content

Localization and Resources

Interested in Development?

Project EAUploader is always looking for development members! Even if you just want to talk to us! Please visit our project’s Discord server. Join here



This page explains how localization works in EAUploader and how to write help messages and EA Library articles. If you would like to help with translation, please read this page too.

This document is based on EAUploader v1.6.2.

How Localization Works


EAUploader gets the string for each language using the English string as the key. English has no translation file, and the key is shown as is.

LanguageLanguage codeTranslation file
EnglishenNone (the key is shown as is)
日本語 (Japanese)jaEditor/Resources/Localization/ja.json
한국어 (Korean)koEditor/Resources/Localization/ko.json

The current language is saved in language of Assets/EAUploader/settings.json. The default is ja.

Translation File Format

A translation file is a JSON file in the following format. name is the name shown in the language selection dropdown.

{
"name": "日本語",
"items": [
{
"key": "Import",
"value": "インポート"
},
{
"key": "Version: ",
"value": "バージョン: "
}
]
}
  • Duplicate keys cause an error.
  • value can use string.Format format items (such as {0}).

Translating UXML Strings

Write English strings directly in UXML.

<ui:Label text="Import Avatars" class="text-lg pb-2 font-bold" />

The main window runs LanguageUtility.Localization every 100ms and replaces the text of every TextElement (Label, Button, etc.) in the window with the value when it exactly matches a key in the translation file. In windows other than the main window, call LanguageUtility.Localization(rootVisualElement) in CreateGUI or similar.

The following elements are not translated.

  • Elements with the USS class no-translate. Add it to user-provided text such as item names and tags.
  • The contents of text input fields (their labels are translated).

Translating C# Strings

To set strings from C#, use T7e.Get.

var label = new Label(T7e.Get("Ready to upload"));
// With format items
T7e.Get("Avatar bundle size is too large. The maximum size is {0} MB, but the current size is {1} MB", limit, fileSize);

If there is no corresponding translation, the key is returned as is.

T7e caches translations. The cache is cleared when a file in Resources/Localization/ is reimported, so edits to translation files apply without a domain reload.

Adding a Language


To add a new language, prepare all of the following files. Use the language code (e.g., zh-cn) for file and folder names.

What to addLocation
UI translation fileEditor/Resources/Localization/{language code}.json
Help messagesEditor/Resources/Message/{language code}/{message number}.txt
EA Library articlesEditor/Resources/UI/TabContents/ImportSettings/Contents/EALibrary/Articles/EAUploader/{language code}/
Viewpoint Position Editor translation fileEditor/Resources/UI/TabContents/Setup/Editor/ViewpointPositionEditor/Localization/{language code}.json

Help Messages


Pressing a “Help” button (HelpButton) shown throughout the screen shows the help message (EAUploaderMessageWindow) as a modal inside the EAUploader window. Messages are loaded for the current language from Editor/Resources/Message/{language code}/{message number}.txt.

In UXML, specify the message number in msg-id.

<eau:HelpButton msg-id="100" class="pb-2" />

From C#, you can show it with EAUploaderMessageWindow.ShowMsg(100) (HelpButtonAPI.ShowMessage(100) in the public API).

Message Numbers in Use

NumberWhere it is shown
100Import window: Import Avatars
101Import window: Import VRM
102Import window: Import Shaders
103Edit screen: Edit tool
104Edit screen: Import extentions (currently hidden)
1083D preview controls
109Upload: How it looks on VRChat
113Upload: Avatar Performance
114Upload: Platform
116Avatar List
117Upload: Blueprint
200VRM conversion window
201Viewpoint Position Editor
202Upload: Avatar Optimization
203Guidance for installing AvatarOptimizer

Files for 105, 107, 111, 112, and 115 still exist but are not used by the v1.6.2 screens.

When adding a new message, use an unused number and add the file to the folders of all languages.

Article Format


Help messages and EA Library articles are rendered by ArticleRenderer. Articles are written with the following tags.

TagFormatContents
<t><t>Heading</t>Shows a heading.
<txt><txt>Body</txt>Shows body text. Unity rich text (<size=16>, <color=red>, <b>, <i>, <u>, etc.) can be used.
<image><image>file name, width</image>Shows an image. The file name is a path relative to the article file. The width can be omitted.
<button><button>label, style, URL</button>Shows a button that opens the URL when pressed. Write Main, Sub, or Link as the style. (In the current implementation, the style makes no visual difference.)
<hr><hr>color, margin</hr>Shows a horizontal line. The color can be black or #RRGGBB.
<section><section>image, width, body</section>Shows an image and body text side by side. The image is shown 200px high. (In the current implementation, the width is not used.)

Example:

<t>Shader error</t>
<txt>
<size=14>The applied shader does not exist in the project.
Check the required shader with the distributor and import it into the project.</size>
</txt>
<button>Join Discord, Main, https://discord.gg/yYFru7brra</button>

EA Library Articles


EA Library articles are stored in the following folder for each language. Create one folder per article.

Editor/Resources/UI/TabContents/ImportSettings/Contents/EALibrary/Articles/EAUploader/
└── en/
├── 001_tutorial1/
│ ├── tutorial1.json Article information
│ ├── Content.txt Article body
│ ├── thumbnail.png Thumbnail
│ └── image1.png Images used in the body
└── 002_tutorial2/
└── ...

Article information is written in a JSON file in the following format. Since the .json file in the folder is read as the article information, do not put more than one .json file in a folder.

{
"title": "Introduction",
"date": "2023-12-07",
"tags": ["Tutorial"],
"keywords": ["Tutorial", "Start", "Guide", "Introduction", "How to use"],
"contentFile": "Content.txt",
"thumbnail": "thumbnail.png"
}
ItemContents
titleTitle of the article. Shown in the list. You can break lines with \n.
dateCreation date of the article
tagsTags. Used for filtering by tag in the EA Library.
keywordsKeywords used for search
contentFileFile name of the body (relative to the JSON file)
thumbnailFile name of the thumbnail (relative to the JSON file)

Write the body in the “Article Format”.