2014-03-11 15:10:11 -07:00
|
|
|
|
//#define DEBUG_SHOW_TRANSLATED_STRINGS
|
|
|
|
|
|
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
using System.IO;
|
|
|
|
|
|
|
|
|
|
|
|
using MatterHackers.MatterControl.DataStorage;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MatterHackers.Localizations
|
|
|
|
|
|
{
|
2014-03-11 15:24:47 -07:00
|
|
|
|
public static class LocalizedString
|
2014-03-11 15:10:11 -07:00
|
|
|
|
{
|
|
|
|
|
|
static TranslationMap MatterControlTranslationMap;
|
|
|
|
|
|
|
2014-03-11 15:24:47 -07:00
|
|
|
|
public static string Get(string EnglishText)
|
2014-03-11 15:10:11 -07:00
|
|
|
|
{
|
2014-03-11 15:57:22 -07:00
|
|
|
|
string language = "en";
|
2014-03-11 15:24:47 -07:00
|
|
|
|
if (language == "en")
|
2014-03-11 15:10:11 -07:00
|
|
|
|
{
|
2014-03-11 15:24:47 -07:00
|
|
|
|
return EnglishText;
|
2014-03-11 15:10:11 -07:00
|
|
|
|
}
|
2014-03-11 15:24:47 -07:00
|
|
|
|
else
|
2014-03-11 15:10:11 -07:00
|
|
|
|
{
|
2014-03-11 15:24:47 -07:00
|
|
|
|
if (MatterControlTranslationMap == null)
|
2014-03-11 15:10:11 -07:00
|
|
|
|
{
|
2014-03-11 15:24:47 -07:00
|
|
|
|
string pathToTranslationsFolder = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Translations");
|
|
|
|
|
|
MatterControlTranslationMap = new TranslationMap(pathToTranslationsFolder, language);
|
2014-03-11 15:10:11 -07:00
|
|
|
|
}
|
2014-03-11 15:10:57 -07:00
|
|
|
|
#if DEBUG_SHOW_TRANSLATED_STRINGS && DEBUG
|
|
|
|
|
|
return "El " + EnglishText + " o";
|
|
|
|
|
|
#else
|
2014-03-11 15:24:47 -07:00
|
|
|
|
return MatterControlTranslationMap.Translate(EnglishText);
|
2014-03-11 15:10:11 -07:00
|
|
|
|
}
|
2014-03-11 15:24:47 -07:00
|
|
|
|
#endif
|
2014-03-11 15:10:11 -07:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|