Skip to content

02. Preparing your Project

tetherscript edited this page Jan 31, 2025 · 12 revisions

In the Translator project folder, you will find a \Target folder. This contains the things that need to be copied over to the Target project. This must be done before you do your first Translator Scan and Translate.

Tip

Look at the sample apps and examine their \Translator, \Strings and TLocalized.cs.

  1. Copy the \Target\TranslatorTLocalized.cs file to the target project, or link to it.
  2. In your project, create \Strings\en-US\ and copy the Translator\Resources.resw file into it. Create folders for each language you want to translate.
  3. Copy the entire \Target\Translator folder to the target project. This folder will hold translation info unique to that target project. Do not include this folder and its files in target project builds or publishing (build action = none, do not copy) as it is not needed by a deployed app. You may edit the Cache.json, XamlElements.json, TTF_*.json and Specials.json. All other files are managed by the Translator app, so don't edit them.

\Translator Contents

  • Cache.json
    Caches translations to save translation costs/latency. Translating will add items to the cache. It won't update existing items. The translated .resw files (non us-EN) are rebuilt from this cache. You can edit this file with the Translator Cache Editor. Your edits will persist.

  • DetectedXamlElements.json
    When you do a scan, all detected XAML be added here. This is informational only and is not used by Translator once the scan is complete. It is useful for viewing/troubleshooting when an element is not translated. If it isn't in this file, then the scanner did not pick it up.

  • Resources.resw
    A blank (no data entries) resource file. Don't edit this blank file. You'll be copying this blank file initially to the /Strings/???/ folders in your target project (??? = en-US or de-DE). When you add a new language, create a new folder and add this file.

  • Specials.json
    Contains non-translatable items like icons, colors, and things that may need to change for some cultures. These are not translated and are added to the Resources.Resw files when you scan and translate. You can edit this file.

  • TLocalizedGets.json
    When you use the included static class TLocalized.Get() with the debugger attached, an entry is created in this file for each unique .Get(). When you do a scan, the detected .xaml element info will be merged with these .Get()'s to produce the \Strings\en-US\Resources.resw file.

  • TTF_OpenAI_1.json
    Defines the prompts sent to the OpenAI_1 Translation Function. You can edit this file.

  • other TTF_*.json files
    Each Translation Function has one of these files. You only need the ones for the Translation Function you want to use for translation.

  • XamlElements.json
    These are the XAML elements and properties that can be detected when scanned. If it isn't on this list, scanning won't find it. You can, and will be editing this file.

Clone this wiki locally