TextTranslation

Those functions are designed to perform translation and uses the translation file named translate_xx where xx is the language code.

Translation data is stored in a text file located in the CamBam system folder. Use Tools - Browse system folder to navigate to this location.

The translation file must be coded in UTF-8 format.

Each line is an entry that can contain 3 fields separated by a tab. this translation file can be created with a plugin

A view off the translation grid generated with the translation plugin.

 

Note: When you create a plugin that uses Windows Forms, to make CamBam automatically adds texts to be translated in the translation table, you must add the character 't' in the Tag property of each object in your form.

In addition, you must add a function in the Windows Form's constructor to run the translation for the Form and sometimes for specifics controls if they are not automatically translated (most time, controls that are in a tab)

In Vb.Net, the constructor is code contained within the following method...

Public Sub New()
    InitializeComponent()
    ' more constructor code...
End Sub

VB Example

 

In C# it will be in a method with the same name as the form/class, for example...

public MyFormName()
{
    InitializeComponent();
    // more constructor code...
}

Warning: You must not add translation code for the menus ; both for main and context menus, CamBam done this himself.
If translation code is added for menus, it cause unwanted entries in the translation table.

 

Fields

FileVersion
const string FileVersion = "1.0"  

 

Methods

CacheAllResourceStrings static void CacheAllResourceStrings()  
CleanResourceStrings static void CleanResourceStrings()  
DownloadLanguageData static void DownloadLanguageData()  
EnglishResource static string EnglishResource(string key)  
GetCache static TextTranslationTable GetCache(LanguageCode lang)  
GetCacheItem

static TextTranslationItem GetCacheItem(LanguageCode lang, string key)

returns a TextTranslationItem that contains the Key, the English text and the translated text

VB

C#

LanguageDescription static string LanguageDescription(LanguageCode lang)  
LoadTranslationTable static void LoadTranslationTable(LanguageCode lang)  
PromptForLanguage static void PromptForLanguage()  
PromptForLanguageDownload static void PromptForLanguageDownload()  
Resource static string Resource(string key)  
SaveTranslationTables static void SaveTranslationTables()  
SetCacheItem

static TextTranslationItem SetCacheItem(LanguageCode lang, string key, string english, string translation)

Adds a new key in the given translation table and sets the corresponding English text and the translated text.
In this case, the key is not the text to translate.

This function is useful if you want be sure to have a specific entry for a text to translate, even if this text already exists in the translation table. It give a way to obtain different translation for a same text.

 

VB

Translate

static string Translate(string key)

Returns the translated text for this key, if no translation is available, or if the key does not exist in the translation table, the given text is returned.

If there is no matching translation key, a default entry will be added to the translation table, which can then be modified using the translation plugin...

 

VB

Translate

static void Translate(Form f)

Performs the translation for the given Windows Form

 
Translate

static void Translate(UserControl control)

Performs the translation for the given control in the Windows Form

 
Translate

static void Translate(Control.ControlCollection controls, LanguageCode lang)

Performs the translation for the given control collection in the Windows Form

 
Translate static string Translate(Type type, string key, LanguageCode lang)  
Translate_fr static string Translate_fr(Type type, string key)  
TranslateMenu static void TranslateMenu(ContextMenuStrip menu, LanguageCode lang)  
TranslateMenu static void TranslateMenu(MainMenu menu, LanguageCode lang)  
TranslateMenu static void TranslateMenu(MenuItem menuitem, LanguageCode lang)  
TranslateMenu static void TranslateMenu(MenuStrip menu, LanguageCode lang)  
TranslateMenu static void TranslateMenu(ToolStripItem menuitem, LanguageCode lang)  
TranslateProperty static string TranslateProperty(PropertyDescriptor pdesc, string name, LanguageCode lang)  
TranslatePropertyInfo static string TranslatePropertyInfo(string ParentType, PropertyDescriptor pdesc, string name, LanguageCode lang)  
Copyright (c) 2011 HexRay Ltd