annotate Lang/Translation.cs @ 15:043a1d8101f2

* Rename "Convert" method to "ToArray" now that the class is more generic no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sun, 25 Jan 2009 13:25:23 +0000
parents 3b7a321e7c4c
children 0352fa33ee8f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
1 using System;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 using System.IO;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
3 using System.Xml;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
4 using System.Xml.Schema;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
5 using System.Collections.Generic;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
6 using System.Reflection;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
7 using System.ComponentModel;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
8 using IBBoard.IO;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
9 using IBBoard.Logging;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
10 using IBBoard.Xml;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
11
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
12 namespace IBBoard.Lang
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
13 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
14 /// <summary>
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
15 /// A basic string translator that loads a default language and a specified language and returns translated strings that correspond to translation IDs.
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
16 /// If the string doesn't exist in the specified language then the translator falls back to the default language. If the translation doesn't exist in the default language
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
17 /// then either a supplied value or a "no validation available" message is returned.
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
18 /// </summary>
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
19 public class Translation
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
20 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
21 private static readonly string DEFAULT_LANGUAGE = "en";
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
22 private static readonly string DIVIDER_STRING = "-";
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
23 private static string lang = "";
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
24 private static DirectoryInfo translationDir;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
25 private static Dictionary<string, string> translationsLocal;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
26 private static Dictionary<string, string> translationsDefault;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
27
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
28 /// <summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
29 /// Initialises the translations for the language specified and the default translations so that the Translation class can be used
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
30 /// </summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
31 /// <param name="appPath">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
32 /// The full path that the application is running from. Must contain the "translations" folder.
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
33 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
34 /// <param name="language">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
35 /// The language to use as the load language
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
36 /// </param>
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
37 public static void InitialiseTranslations(string appPath, string language)
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
38 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
39 InitialiseDefaults(appPath);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
40 FileInfo file = GetTranslationFile(DEFAULT_LANGUAGE);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
41 XmlDocument doc = LoadTranslationDocument(file);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
42 LoadTranslationsFromDocument(doc, translationsDefault);
10
3b7a321e7c4c Fixes #4 - unexpected exception in translations
IBBoard <dev@ibboard.co.uk>
parents: 9
diff changeset
43 LoadTranslationForLanguage(language);
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
44 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
45
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
46 private static void InitialiseDefaults(string appPath)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
47 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
48 string translationPath = appPath.TrimEnd(Constants.DirectoryChar) + Constants.DirectoryString + "translations";
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
49
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
50 if (Directory.Exists(translationPath))
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
51 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
52 translationsDefault = new Dictionary<string,string>();
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
53 translationsLocal = new Dictionary<string,string>();
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
54 translationDir = new DirectoryInfo(translationPath);
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
55 }
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
56 else
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
57 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
58 throw new ArgumentException("Translation path must exist ("+translationPath+")");
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
59 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
60 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
61
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
62 private static XmlDocument LoadTranslationDocument(FileInfo file)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
63 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
64 XmlDocument doc = new XmlDocument();
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
65 XmlReaderSettings settings = new XmlReaderSettings();
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
66 settings.XmlResolver = new IBBXmlResolver(translationDir.Parent.FullName);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
67 settings.ValidationType = ValidationType.DTD;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
68 settings.ProhibitDtd = false;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
69 settings.ValidationEventHandler+= new ValidationEventHandler(ValidationEventMethod);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
70 XmlReader valReader = XmlReader.Create(file.FullName, settings);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
71 doc.Load(valReader);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
72 valReader.Close();
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
73 return doc;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
74 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
75
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
76 private static FileInfo GetTranslationFile(string language)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
77 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
78 FileInfo file = new FileInfo(translationDir.FullName + Constants.DirectoryString + language + ".translation");
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
79
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
80 if (!file.Exists)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
81 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
82 throw new FileNotFoundException(language + "translation could not be found in "+translationDir.FullName);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
83 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
84
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
85 return file;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
86 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
87
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
88 private static void LoadTranslationsFromDocument(XmlDocument doc, Dictionary<string, string> translationTable)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
89 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
90 try
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
91 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
92 XmlNodeList translations = doc.GetElementsByTagName("translation");
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
93
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
94 if (translations.Count==0)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
95 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
96 throw new InvalidFileException("No translations found in "+GetLanguageOfDocument(doc)+".translation");
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
97 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
98
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
99 Dictionary<string, string> tempTranslationTable = new Dictionary<string,string>();
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
100
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
101 foreach (XmlNode node in translations)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
102 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
103 tempTranslationTable.Add(node.Attributes["id"].Value, node.InnerText);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
104 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
105
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
106 translationTable.Clear();
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
107
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
108 foreach (string key in tempTranslationTable.Keys)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
109 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
110 string translation;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
111 tempTranslationTable.TryGetValue(key, out translation);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
112 translationTable.Add(key, translation);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
113 }
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
114 }
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
115 catch(Exception ex)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
116 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
117 throw new XmlParseException("Error while parsing " + GetLanguageOfDocument(doc)+" translation: "+ex.Message);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
118 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
119 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
120
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
121 private static string GetLanguageOfDocument(XmlDocument doc)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
122 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
123 return doc != null ? doc.DocumentElement.GetAttribute("lang") : "";
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
124 }
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
125
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
126 private static void ValidationEventMethod(object sender, ValidationEventArgs e)
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
127 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
128 //TODO: Fire a validation failure event
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
129 LogNotifier.Error(typeof(Translation), "Validation Error", e.Exception);
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
130 }
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
131
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
132 /// <summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
133 /// Loads translations for a given language and sets them as the local language
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
134 /// </summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
135 /// <param name="translationLang">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
136 /// The new local language to load
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
137 /// </param>
7
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
138 public static void LoadTranslation(string translationLanguage)
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
139 {
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
140 if (translationLanguage == "" || translationLanguage == null)
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
141 {
10
3b7a321e7c4c Fixes #4 - unexpected exception in translations
IBBoard <dev@ibboard.co.uk>
parents: 9
diff changeset
142 throw new ArgumentException("Translation language cannot be null or empty");
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
143 }
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
144
8
d6ce8764e92b Fix typo in method name reference
IBBoard <dev@ibboard.co.uk>
parents: 7
diff changeset
145 LoadTranslationForLanguage(translationLanguage);
7
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
146 }
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
147
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
148 private static void LoadTranslationForLanguage(string translationLanguage)
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
149 {
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
150 checkInitialisation();
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
151
f4da31cb09d9 * Add translation DTD to utils project
IBBoard <dev@ibboard.co.uk>
parents: 6
diff changeset
152 if (translationLanguage != DEFAULT_LANGUAGE && translationLanguage != "" && translationLanguage != null)
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
153 {
9
562390c8d618 Fix variable name errors
IBBoard <dev@ibboard.co.uk>
parents: 8
diff changeset
154 FileInfo file = GetTranslationFile(translationLanguage);
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
155 XmlDocument doc = LoadTranslationDocument(file);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
156 LoadTranslationsFromDocument(doc, translationsLocal);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
157 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
158 else
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
159 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
160 translationsLocal.Clear();
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
161 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
162
9
562390c8d618 Fix variable name errors
IBBoard <dev@ibboard.co.uk>
parents: 8
diff changeset
163 lang = translationLanguage;
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
164 }
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
165
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
166 /// <summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
167 /// Gets a translation for a given ID, falling back to a "missing translation" message if none can be found. Also optionally replaces any placeholders with the supplied values.
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
168 /// </summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
169 /// <param name="translationID">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
170 /// The ID to look up the translation for
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
171 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
172 /// <param name="replacements">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
173 /// A collection of <see cref="System.Object"/>s to replace placeholders with
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
174 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
175 /// <returns>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
176 /// The translation with the placeholders replaced or a "missing translation" message
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
177 /// </returns>
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
178 public static string GetTranslation(string translationID, params object[] replacements)
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
179 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
180 return GetTranslation(translationID, false, replacements);
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
181 }
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
182
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
183 /// <summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
184 /// Gets a translation for a given ID, falling back to null or a warning message if a translation cannot be found. Also optionally replaces any placeholders with the supplied values.
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
185 /// </summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
186 /// <param name="translationID">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
187 /// The ID to look up the translation for
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
188 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
189 /// <param name="returnNullOnFail">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
190 /// TRUE if null should be returned when no translation can be found, or FALSE if a "missing translation" message should be returned
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
191 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
192 /// <param name="replacements">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
193 /// A collection of <see cref="System.Object"/>s to replace placeholders with
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
194 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
195 /// <returns>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
196 /// The translation with the placeholders replaced, or a "missing translation" message or null depending on <param name="returnNullOnFail">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
197 /// </returns>
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
198 public static string GetTranslation(string translationID, bool returnNullOnFail, params object[] replacements)
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
199 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
200 return GetTranslation(translationID, returnNullOnFail ? null : "", replacements);
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
201 }
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
202
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
203 /// <summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
204 /// Gets a translation for a given ID, falling back to a supplied default if a translation cannot be found. Also optionally replaces any placeholders with the supplied values.
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
205 /// </summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
206 /// <param name="translationID">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
207 /// The ID to look up the translation for
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
208 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
209 /// <param name="defaultTranslation">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
210 /// The string to return if no translation can be found. Can be null or any string.
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
211 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
212 /// <param name="replacements">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
213 /// A collection of <see cref="System.Object"/>s to replace placeholders with
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
214 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
215 /// <returns>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
216 /// The translation, if one exists, or the supplied default with the placeholders replaced
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
217 /// </returns>
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
218 public static string GetTranslation(string translationID, string defaultTranslation, params object[] replacements)
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
219 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
220 checkInitialisation();
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
221 string trans = GetTranslationFromTables(translationID);
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
222
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
223 if (trans == null)
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
224 {
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
225 trans = GetDefaultTranslation(translationID, defaultTranslation);
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
226 }
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
227
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
228 trans = AddVariablesToTranslation(trans, replacements);
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
229
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
230 return trans;
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
231 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
232
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
233 private static string GetTranslationFromTables(string translationID)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
234 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
235 string translation = null;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
236
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
237 if (translationsLocal!=null)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
238 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
239 translationsLocal.TryGetValue(translationID, out translation);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
240 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
241
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
242 if (translation == null)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
243 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
244 translationsDefault.TryGetValue(translationID, out translation);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
245 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
246
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
247 return translation;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
248 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
249
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
250 private static string GetDefaultTranslation(string translationID, string defaultTranslation)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
251 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
252 return (defaultTranslation != "" && defaultTranslation != null) ? defaultTranslation : GetMissingTranslationMessage(translationID);
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
253 }
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
254
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
255 private static string GetMissingTranslationMessage(string translationID)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
256 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
257 return "++ Missing Translation "+translationID+" ++";
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
258 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
259
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
260 private static string AddVariablesToTranslation(string translation, object[] replacements)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
261 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
262 if (translation != null && replacements != null && replacements.Length > 0)
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
263 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
264 translation = String.Format(translation, replacements);
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
265 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
266
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
267 return translation;
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
268 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
269
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
270 private static void checkInitialisation()
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
271 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
272 if (translationDir==null)
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
273 {
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
274 throw new InvalidOperationException("Translation class has not been initialised");
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
275 }
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
276 }
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
277
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
278 /// <summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
279 /// Translate an <see cref="ITranslatable"/> item, with optional string replacement
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
280 /// </summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
281 /// <param name="item">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
282 /// A <see cref="ITranslatable"/> to set the text for
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
283 /// </param>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
284 /// <param name="replacements">
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
285 /// A collection of <see cref="System.Object"/>s that will be used to fill place-holders
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
286 /// </param>
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
287 public static void Translate(ITranslatable item, params object[] replacements)
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
288 {
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
289 if (item.Text == "" || item.Text == DIVIDER_STRING)
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
290 {
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
291 //it doesn't need translating - either there is no text from the developer or it's a hyphen for a divider
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
292 return;
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
293 }
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
294
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
295 item.Text = GetTranslation(item.Name, replacements);
6
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
296 }
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
297
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
298 /// <summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
299 /// Get the current local translation language. This is an arbitrary string used in the translation file's name and will not necessarily match the ISO language code.
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
300 /// </summary>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
301 /// <returns>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
302 /// The string used in the file name of the current local translation
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
303 /// </returns>
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
304 public static string GetTranslationLanguage()
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
305 {
f269d8bcc152 Re #2 - Refactor API
IBBoard <dev@ibboard.co.uk>
parents: 4
diff changeset
306 return lang;
0
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
307 }
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
308 }
961030992bd2 Initial commit of IBBoard libraries
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
309 }