Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added new translation strings and russian translation file #878

Merged
merged 5 commits into from
Jul 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
124 changes: 124 additions & 0 deletions PoGo.NecroBot.CLI/Config/Translations/translation.ru_RU.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
{
"TranslationStrings": [
{
"Key": "pokeball",
"Value": "PokeBall"
},
{
"Key": "greatPokeball",
"Value": "GreatBall"
},
{
"Key": "ultraPokeball",
"Value": "UltraBall"
},
{
"Key": "masterPokeball",
"Value": "MasterBall"
},
{
"Key": "wrongAuthType",
"Value": "Неизвестный AuthType в config.json"
},
{
"Key": "farmPokestopsOutsideRadius",
"Value": "Вы находитесь вне указанного радиуса! Идем кк точке старта ({0}m away) через 5 сек. Ваш Coords.ini файл корректен?"
},
{
"Key": "farmPokestopsNoUsableFound",
"Value": "Не найдено активных PokeStops в вашей зоне. Может указана слишком мальенькая максимальная дистанция поиска в настройках?"
},
{
"Key": "eventFortUsed",
"Value": "XP: {0}, Gems: {1}, Предметов: {2}"
},
{
"Key": "eventFortTargeted",
"Value": "{0} через ({1}m)"
},
{
"Key": "eventProfileLogin",
"Value": "Играем за {0}"
},
{
"Key": "eventUsedLuckyEgg",
"Value": "Использовано Lucky Egg, осталось: {0}"
},
{
"Key": "eventPokemonEvolvedSuccess",
"Value": "{0} успешно за {1}xp"
},
{
"Key": "eventPokemonEvolvedFailed",
"Value": "Не удалось {0}. Результат: {1}, прекращаем эволюционирование {2}"
},
{
"Key": "eventPokemonTransferred",
"Value": "{0}\t- CP: {1} IV: {2}% [Лучший CP: {3} IV: {4}%] (Конфеток: {5})"
},
{
"Key": "eventItemRecycled",
"Value": "{0}x {1}"
},
{
"Key": "eventPokemonCapture",
"Value": "({0}) | ({1}) {2} Lvl: {3} CP: ({4}/{5}) IV: {6}% | Шанс: {7}% | {8}m дист | с {9} ({10} осталось). | {11}"
},
{
"Key": "eventNoPokeballs",
"Value": "Нет Pokeball'ов - Мы упустили {0} с CP {1}"
},
{
"Key": "catchStatusAttempt",
"Value": "{0} Попытка #{1}"
},
{
"Key": "catchStatus",
"Value": "{0}"
},
{
"Key": "candies",
"Value": "Конфеток: {0}"
},
{
"Key": "unhandledGPXData",
"Value": "Неизвестные данные в GPX файле, пробуем пропустить."
},
{
"Key": "displayHighestsHeader",
"Value": "ТОП покемонов"
},
{
"Key": "commonWordPerfect",
"Value": "идеальный"
},
{
"Key": "commonWordName",
"Value": "имя"
},
{
"Key": "displayHighestsCPHeader",
"Value": "ТОП по CP"
},
{
"Key": "displayHighestsPerfectHeader",
"Value": "ТОП по идеальным статам"
},
{
"Key": "welcomeWarning",
"Value": "Убедитесь, что Широта и Долгота верны! Закройте программу если это не так! Широта: {0} Долгота: {1}"
},
{
"Key": "incubatorPuttingEgg",
"Value": "Кладем яйцо в инкубатор: {0:0.00}км осталось"
},
{
"Key": "incubatorStatusUpdate",
"Value": "Статус инкубатора: {0:0.00}км осталось"
},
{
"Key": "displayHighestsLevelHeader",
"Value": "ТОП по уровню"
}
]
}
28 changes: 24 additions & 4 deletions PoGo.NecroBot.CLI/ConsoleEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public void HandleEvent(ItemRecycledEvent evt, Context ctx)
public void HandleEvent(EggIncubatorStatusEvent evt, Context ctx)
{
if (evt.WasAddedNow)
Logger.Write($"Putting egg in incubator: {evt.KmRemaining:0.00}km left");
Logger.Write(ctx.Translations.GetTranslation(TranslationString.IncubatorPuttingEgg, evt.KmRemaining));
else
Logger.Write($"Incubator status update: {evt.KmRemaining:0.00}km left");
Logger.Write(ctx.Translations.GetTranslation(TranslationString.IncubatorStatusUpdate, evt.KmRemaining));
}

public void HandleEvent(FortUsedEvent evt, Context ctx)
Expand Down Expand Up @@ -121,10 +121,30 @@ public void HandleEvent(UseBerryEvent evt, Context ctx)

public void HandleEvent(DisplayHighestsPokemonEvent evt, Context ctx)
{
Logger.Write($"====== DisplayHighests{evt.SortedBy} ======", LogLevel.Info, ConsoleColor.Yellow);
string strHeader;
//PokemonData | CP | IV | Level
switch (evt.SortedBy)
{
case "Level":
strHeader = ctx.Translations.GetTranslation(TranslationString.DisplayHighestsLevelHeader);
break;
case "IV":
strHeader = ctx.Translations.GetTranslation(TranslationString.DisplayHighestsPerfectHeader);
break;
case "CP":
strHeader = ctx.Translations.GetTranslation(TranslationString.DisplayHighestsCPHeader);
break;
default:
strHeader = ctx.Translations.GetTranslation(TranslationString.DisplayHighestsHeader);
break;
}
var strPerfect = ctx.Translations.GetTranslation(TranslationString.CommonWordPerfect);
var strName = ctx.Translations.GetTranslation(TranslationString.CommonWordName).ToUpper();

Logger.Write($"====== {strHeader} ======", LogLevel.Info, ConsoleColor.Yellow);
foreach (var pokemon in evt.PokemonList)
Logger.Write(
$"# CP {pokemon.Item1.Cp.ToString().PadLeft(4, ' ')}/{pokemon.Item2.ToString().PadLeft(4, ' ')} | ({pokemon.Item3.ToString("0.00")}% perfect)\t| Lvl {pokemon.Item4.ToString("00")}\t NAME: '{pokemon.Item1.PokemonId}'",
$"# CP {pokemon.Item1.Cp.ToString().PadLeft(4, ' ')}/{pokemon.Item2.ToString().PadLeft(4, ' ')} | ({pokemon.Item3.ToString("0.00")}% {strPerfect})\t| Lvl {pokemon.Item4.ToString("00")}\t {strName}: '{pokemon.Item1.PokemonId}'",
LogLevel.Info, ConsoleColor.Yellow);
}

Expand Down
22 changes: 21 additions & 1 deletion PoGo.NecroBot.Logic/Common/Translations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,17 @@ public string GetTranslation(TranslationString translationString)
new KeyValuePair<TranslationString, string>(Common.TranslationString.EventNoPokeballs, "No Pokeballs - We missed a {0} with CP {1}"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.CatchStatusAttempt, "{0} Attempt #{1}"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.CatchStatus, "{0}"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.Candies, "Candies: {0}")
new KeyValuePair<TranslationString, string>(Common.TranslationString.Candies, "Candies: {0}"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.UnhandledGPXData, "Unhandled data in GPX file, attempting to skip."),
new KeyValuePair<TranslationString, string>(Common.TranslationString.DisplayHighestsHeader, "DisplayHighests"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.CommonWordPerfect, "perfect"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.CommonWordName, "name"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.DisplayHighestsCPHeader, "DisplayHighestsCP"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.DisplayHighestsPerfectHeader, "DisplayHighestsPerfect"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.DisplayHighestsLevelHeader, "DisplayHighestsLevel"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.WelcomeWarning, "Make sure Lat & Lng are right. Exit Program if not! Lat: {0} Lng: {1}"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.IncubatorPuttingEgg, "Putting egg in incubator: {0:0.00}km left"),
new KeyValuePair<TranslationString, string>(Common.TranslationString.IncubatorStatusUpdate, "Incubator status update: {0:0.00}km left"),
};
}

Expand Down Expand Up @@ -115,5 +125,15 @@ public enum TranslationString
CatchStatusAttempt,
CatchStatus,
Candies,
UnhandledGPXData,
DisplayHighestsHeader,
CommonWordPerfect,
CommonWordName,
DisplayHighestsCPHeader,
DisplayHighestsPerfectHeader,
WelcomeWarning,
IncubatorPuttingEgg,
IncubatorStatusUpdate,
DisplayHighestsLevelHeader,
}
}
3 changes: 1 addition & 2 deletions PoGo.NecroBot.Logic/State/PositionCheckState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,7 @@ public async Task<IState> Execute(Context ctx, StateMachine machine)

machine.Fire(new WarnEvent
{
Message =
$"Make sure Lat & Lng are right. Exit Program if not! Lat: {ctx.Client.CurrentLatitude} Lng: {ctx.Client.CurrentLongitude}"
Message = ctx.Translations.GetTranslation(Common.TranslationString.WelcomeWarning, ctx.Client.CurrentLatitude, ctx.Client.CurrentLongitude)
});

await Task.Delay(3000);
Expand Down
2 changes: 1 addition & 1 deletion PoGo.NecroBot.Logic/Tasks/FarmPokestopsGPXTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ await ctx.Navigation.HumanPathWalking(trackPoints.ElementAt(curTrkPt),
private static List<GpxReader.Trk> GetGpxTracks(Context ctx)
{
var xmlString = File.ReadAllText(ctx.LogicSettings.GpxFile);
var readgpx = new GpxReader(xmlString);
var readgpx = new GpxReader(xmlString, ctx);
return readgpx.Tracks;
}

Expand Down
9 changes: 7 additions & 2 deletions PoGo.NecroBot.Logic/Utils/GPXReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using System.Collections.Generic;
using System.Xml;
using PoGo.NecroBot.Logic.Logging;
using PoGo.NecroBot.Logic.Common;
using PoGo.NecroBot.Logic.State;

#endregion

Expand All @@ -32,8 +34,11 @@ public class GpxReader
public string UrlName = "";
public List<Wpt> WayPoints = new List<Wpt>();

public GpxReader(string xml)
private Context _ctx;

public GpxReader(string xml, Context ctx)
{
_ctx = ctx;
if (xml.Equals("")) return;
_gpx.LoadXml(xml);
if (_gpx.DocumentElement == null || !_gpx.DocumentElement.Name.Equals("gpx")) return;
Expand Down Expand Up @@ -104,7 +109,7 @@ public GpxReader(string xml)
case "topografix:map":
break;
default:
Logger.Write("Unhandled data in GPX file, attempting to skip.", LogLevel.Info);
Logger.Write(ctx.Translations.GetTranslation(TranslationString.UnhandledGPXData), LogLevel.Info);
break;
}
}
Expand Down