Skip to content
This repository has been archived by the owner on Aug 29, 2018. It is now read-only.

Translations

Dr.Hacknik edited this page Apr 26, 2016 · 4 revisions

Language INI files

Because the INI file format is robust, and easy to edit and understand, it was used in the translation engine.

This example proves my point:

[_meta]
language=English
translator=MarcusD

[FirstTimeWizard]
title=3DNUS - First time setup Wizard

[EulaDialog]
title=License agreements
accept=I accept the license requirements
decline=I decline the license requirements
next=Next

[Main]
download=Download
mode_legacy=Legacy mode

Translating the window (technical)

There's the _3DNUS.i18n namespace that provides 2 classes: Localizer and LocalizedForm.

Translating using LocalizedForm

You can very easily translate your Form, if you're using LocalizedForm, just follow the below steps:

  1. Import the _3DNUS.i18n namespace
  2. Make sure your Form extends LocalizedForm (change : Form to : LocalizedForm
  3. Override the TranslationTrigger function
  4. In the overridden function, yield return the controls you want to translate
  5. Set the Tag property of the controls to a String, which will be later used to identify the translation in the language file
  6. Set the Tag property of the Form to a String, which will be used as the section name identifier in the language file
  7. Place the translation files in the <source>/i18n folder, and set the build action to Embedded resource

Example:

using _3DNUS.i18n;

public class FormDemo : LocalizedForm
{
    public FormDemo() : base()
    {
        InitializeComponent();
        this.Tag = "DemoDialog";
        Label1.Tag = "info";
        ButtonRetranslate.Tag = "retranslate";
    }
    public override IEnumerable<Control> TranslationTrigger()
    {
        yield return Label1;
        yield return ButtonRetranslate;
    }

    protected void ButtonRetranslate_Click(object sender, EventArgs e)
    {
        Localizer.PleaseTrigger(this);
    }
}
[DemoDialog]
info=Click the below button to retranslate this form:
retranslate=Click me to retranslate this window!

Welcome to the Wiki for 3DNUS. Currently, the Wiki is still being worked on! Soon though, it'll be completed!

Clone this wiki locally