mattercontrol/LocalizedString.cs
larsbrubaker 2def10590e Made the first pass of actually doing the localizations.
There is now a small bit of Spanish localization.
Moved the LocalizedString into MC so that it is clearer that translation files aren't saved.
2014-03-11 15:10:11 -07:00

55 lines
1.4 KiB
C#
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//#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 class LocalizedString
{
static TranslationMap MatterControlTranslationMap;
string englishText;
string EnglishText
{
get
{
return englishText;
}
}
public string Translated
{
get
{
if (MatterControlTranslationMap == null)
{
string pathToTranslationsFolder = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Translations");
MatterControlTranslationMap = new TranslationMap(pathToTranslationsFolder, "es");
}
#if DEBUG_SHOW_TRANSLATED_STRINGS && DEBUG
return "El " + EnglishText + " o";
#else
if (MatterControlTranslationMap.TwoLetterIsoLanguageName == "en")
{
return EnglishText;
}
else
{
return MatterControlTranslationMap.Translate(EnglishText);
}
#endif
}
}
public LocalizedString(string EnglishText)
{
this.englishText = EnglishText;
}
}
}