mattercontrol/LocalizedString.cs

40 lines
1.1 KiB
C#
Raw Normal View History

//#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
{
static TranslationMap MatterControlTranslationMap;
2014-03-11 15:24:47 -07:00
public static string Get(string EnglishText)
{
string language = "en";
2014-03-11 15:24:47 -07:00
if (language == "en")
{
2014-03-11 15:24:47 -07:00
return EnglishText;
}
2014-03-11 15:24:47 -07:00
else
{
2014-03-11 15:24:47 -07:00
if (MatterControlTranslationMap == null)
{
2014-03-11 15:24:47 -07:00
string pathToTranslationsFolder = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Translations");
MatterControlTranslationMap = new TranslationMap(pathToTranslationsFolder, language);
}
#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:24:47 -07:00
#endif
}
}
}