39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
//#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
|
||
{
|
||
public static class LocalizedString
|
||
{
|
||
static TranslationMap MatterControlTranslationMap;
|
||
|
||
public static string Get(string EnglishText)
|
||
{
|
||
string language = "en";
|
||
if (language == "en")
|
||
{
|
||
return EnglishText;
|
||
}
|
||
else
|
||
{
|
||
if (MatterControlTranslationMap == null)
|
||
{
|
||
string pathToTranslationsFolder = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Translations");
|
||
MatterControlTranslationMap = new TranslationMap(pathToTranslationsFolder, language);
|
||
}
|
||
#if DEBUG_SHOW_TRANSLATED_STRINGS && DEBUG
|
||
return "El " + EnglishText + " o";
|
||
#else
|
||
return MatterControlTranslationMap.Translate(EnglishText);
|
||
}
|
||
#endif
|
||
}
|
||
}
|
||
}
|