An open API service indexing awesome lists of open source software.

https://github.com/xen-42/outer-wilds-localization-utility

A utility for creating translation mods for Outer Wilds with minimal code
https://github.com/xen-42/outer-wilds-localization-utility

mod translation unity

Last synced: 10 months ago
JSON representation

A utility for creating translation mods for Outer Wilds with minimal code

Awesome Lists containing this project

README

          

# Outer Wilds Translation Mod Utility

This project is meant to have common code required for translation mods.

Based on [Outer Wilds Korean Translation](https://outerwildsmods.com/mods/outerwildskoreantranslation/) and [Outer Wilds Traditional Chinese Translation](https://outerwildsmods.com/mods/outerwildstraditionalchinesetranslation/).

## Getting started

1. Create a base OWML mod following the [getting started guide.](https://owml.outerwildsmods.com/guides/getting_started.html). For this example we're calling our mod `DothrakiTranslation` but replace that with whatever language you're working on.
2. Add a dictionary entry to the end of the `manifest.json` dict that specifies the dependency for Outer Wilds Mod Manager:
```json
"dependencies": [
"xen.LocalizationUtility"
]
```

Note that this will not automatically install the dependency, however the Outer Wilds Mod Manager will prompt users to install and enable the dependency when they enable your translation mod.
3. Add a file called `ILocalizationAPI.cs` (a C# interface) into your mod directory, with the following content - replace `DothrakiTranslation` with the name of your translation, of course:
```cs
using OWML.ModHelper;
using System;

namespace DothrakiTranslation
{
public interface ILocalizationAPI
{
void RegisterLanguage(ModBehaviour mod, string name, string translationPath);
void AddLanguageFont(ModBehaviour mod, string name, string assetBundlePath, string fontPath);
void AddLanguageFixer(string name, Func fixer);
}
}
```
4. In your base `ModBehaviour` class (`DothrakiTranslation.cs` in our case), access the utility mod like so:
```cs
namespace DothrakiTranslation
{
public class DothrakiTranslation : ModBehaviour
{
public static DothrakiTranslation Instance;

private void Start()
{
var api = ModHelper.Interaction.TryGetModApi("xen.LocalizationUtility");
api.RegisterLanguage(this, "Dothraki", "assets/Translation.xml");
}
}
}
```
This assumes that the XML file with original text and your translations is in the `assets/Translation.xml` file.
5. Optionally, add a font or a fixer function with `api.AddLanguageFont` or `api.AddLanguageFixer` underneath the `api.RegisterLanguage` line. Adding a font is optional. A "fixer" function will take in a string and output a string where the characters have been correctly reformatted. This is necessary for certain languages, e.g. right-to-left languages like Arabic or Farsi. Make sure to call all these methods at the same time, starting with `RegisterLanguage`, else they may not work as intended.

## Other info

This repo contains the base game English translation file (Translation.xml) which can be used as a template for any translation mod. Just translate the entries of the XML and leave the original English entries alone.

When adding a font, you must first package it into a Unity asset bundle. Use Unity 2019.4.27f1 for this (Unity Hub has options for downloading legacy versions of Unity) as this is the version Outer Wilds was released in.