Skip to content

08. Translating Scan Results

tetherscript edited this page Jan 31, 2025 · 6 revisions

Translating

  • Reads target\Strings\en-US\Resources.resw and calls a Translation Function for each item with a hint token in the comments field.
  • Saves the translation in the cache, and then saves the translations and Specials in your non-en-US target\Strings\???\Resources.resw files, where ??? = de-DE, ar-SA, etc.

Caching Translations

Translations are cached in Cache.json for re-use. This saves cost and makes the translation process faster so you don't need to call the translation function as often.

You might do a translation, test it, approve and deploy it. Then for the next release, you translate again but this time the translation function ex. OpenAI API might use a slightly different model, returning a slightly different translations. These models will improve over time, but you don't want it re-translating things you have already approved. So translations that are cached, will not be replaced by the translation function.

Sometimes, the translation function just doesn't get it right, and you need to manually edit the cache so the correct translation is used. You can do this in the Cache Editor.

For a small commercial app, using the the OpenAI API translation function through probably over 50 scan/translation cycles cost around $5 USD in API credits (as of Jan 2025) to translate. The cache really helps reduce the cost here.

Important

You can also run translations locally and for free, depending on the model/API/hardware you use. AI API specs/prompt designs are wildly non-standard and changing frequently as of this time, so the app's code is flexible, allowing you to add your own Translator Function using the API of your choice.

Translator Functions

  • Check the source and locate the Translator Function section.
  • Use the OpenAI Translator Function as an example.
  • Add an item to the function picklist and tweak the code to select which function to use based on the selected picklist item.

Summary

  • Your translations are complete, and .resw files are updated.
  • Start the target app, and you should see the translations.

Here's what translating the sample app Sample-Packaged looks like.

translate1

Clone this wiki locally