Fixing up the localization file to always maintain the master file when in English

added localized start and end to gcode view
Made the TAZ baud rate correct
Some new localizations
This commit is contained in:
larsbrubaker 2014-03-15 14:02:43 -07:00
parent b68cda8ffe
commit c6f471c7ca
6 changed files with 61 additions and 22 deletions

View file

@ -47,10 +47,12 @@ namespace MatterHackers.Localizations
public void LoadTranslation(string pathToTranslationsFolder, string twoLetterIsoLanguageName)
{
this.twoLetterIsoLanguageName = twoLetterIsoLanguageName;
this.pathToMasterFile = Path.Combine(pathToTranslationsFolder, "Master.txt");
ReadIntoDictonary(masterDictionary, pathToMasterFile);
this.pathToTranslationFile = Path.Combine(pathToTranslationsFolder, twoLetterIsoLanguageName, "Translation.txt");
this.pathToTranslationFile = Path.Combine(pathToTranslationsFolder, TwoLetterIsoLanguageName, "Translation.txt");
if (File.Exists(pathToTranslationFile))
{
ReadIntoDictonary(translationDictionary, pathToTranslationFile);
@ -64,11 +66,14 @@ namespace MatterHackers.Localizations
}
}
foreach (KeyValuePair<string, string> keyValue in masterDictionary)
if (TwoLetterIsoLanguageName != "en")
{
if (!translationDictionary.ContainsKey(keyValue.Key))
foreach (KeyValuePair<string, string> keyValue in masterDictionary)
{
AddNewString(translationDictionary, pathToTranslationFile, keyValue.Key);
if (!translationDictionary.ContainsKey(keyValue.Key))
{
AddNewString(translationDictionary, pathToTranslationFile, keyValue.Key);
}
}
}
}
@ -122,7 +127,10 @@ namespace MatterHackers.Localizations
string tranlatedString;
if (!translationDictionary.TryGetValue(englishString, out tranlatedString))
{
AddNewString(translationDictionary, pathToTranslationFile, englishString);
if (TwoLetterIsoLanguageName != "en")
{
AddNewString(translationDictionary, pathToTranslationFile, englishString);
}
AddNewString(masterDictionary, pathToMasterFile, englishString);
return englishString;
}

View file

@ -17,23 +17,15 @@ namespace MatterHackers.Localizations
public static string Get(string EnglishText)
{
string language = "en";
if (language == "en")
if (MatterControlTranslationMap == null)
{
return EnglishText;
string pathToTranslationsFolder = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "Translations");
MatterControlTranslationMap = new TranslationMap(pathToTranslationsFolder, language);
}
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);
}
return "El " + EnglishText + " o";
#endif
return MatterControlTranslationMap.Translate(EnglishText);
}
}
}

View file

@ -517,12 +517,12 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged);
AddChild(selectLayerSlider);
AddChild(new TextWidget("start:", 50, 77, 10, Agg.Font.Justification.Right));
AddChild(new TextWidget(LocalizedString.Get("start:"), 50, 77, 10, Agg.Font.Justification.Right));
layerStartRenderRatioSlider = new Slider(new Vector2(), 10);
layerStartRenderRatioSlider.ValueChanged += new EventHandler(layerStartRenderRatioSlider_ValueChanged);
AddChild(layerStartRenderRatioSlider);
AddChild(new TextWidget("end:", 50, 57, 10, Agg.Font.Justification.Right));
AddChild(new TextWidget(LocalizedString.Get("end:"), 50, 57, 10, Agg.Font.Justification.Right));
layerEndRenderRatioSlider = new Slider(new Vector2(), 10);
layerEndRenderRatioSlider.Value = 1;
layerEndRenderRatioSlider.ValueChanged += new EventHandler(layerEndRenderRatioSlider_ValueChanged);

View file

@ -1 +1 @@
baud_rate = 250000
baud_rate = 115200

View file

@ -1 +1 @@
baud_rate = 250000
baud_rate = 115200

View file

@ -865,3 +865,42 @@ Translated:View Queue and Library
English:Bed Temperature
Translated:Bed Temperature
English:This gcode will be inserted when the print is canceled.
Translated:This gcode will be inserted when the print is canceled.
English:This gcode will be inserted when the printer is paused.
Translated:This gcode will be inserted when the printer is paused.
English:This gcode will be inserted when the printer is resumed.
Translated:This gcode will be inserted when the printer is resumed.
English:Print Time
Translated:Print Time
English:Filament Length
Translated:Filament Length
English:Filament Volume
Translated:Filament Volume
English:Weight
Translated:Weight
English:Show Grid
Translated:Show Grid
English:Show Moves
Translated:Show Moves
English:Show Retractions
Translated:Show Retractions
English:Go
Translated:Go
English:start:
Translated:start:
English:end:
Translated:end: