diff --git a/Geekbot.net/Geekbot.net.csproj b/Geekbot.net/Geekbot.net.csproj index fcf7b95..405c17e 100755 --- a/Geekbot.net/Geekbot.net.csproj +++ b/Geekbot.net/Geekbot.net.csproj @@ -58,6 +58,7 @@ 4.3.0 + @@ -87,9 +88,6 @@ PreserveNewest - - Always - Always diff --git a/Geekbot.net/Lib/Localization/TranslationHandler.cs b/Geekbot.net/Lib/Localization/TranslationHandler.cs index 8100478..51c516c 100644 --- a/Geekbot.net/Lib/Localization/TranslationHandler.cs +++ b/Geekbot.net/Lib/Localization/TranslationHandler.cs @@ -9,6 +9,8 @@ using Geekbot.net.Database.Models; using Geekbot.net.Lib.Extensions; using Geekbot.net.Lib.Logger; using Utf8Json; +using YamlDotNet.RepresentationModel; +using YamlDotNet.Serialization; namespace Geekbot.net.Lib.Localization { @@ -32,8 +34,15 @@ namespace Geekbot.net.Lib.Localization { try { - var translationFile = File.ReadAllText(Path.GetFullPath("./Lib/Localization/Translations.json")); - var rawTranslations = JsonSerializer.Deserialize>>>>(translationFile); + // Read the file + var translationFile = File.ReadAllText(Path.GetFullPath("./Lib/Localization/Translations.yml")); + + // Deserialize + var input = new StringReader(translationFile); + var deserializer = new DeserializerBuilder().Build(); + var rawTranslations = deserializer.Deserialize>>>>(input); + + // Sort var sortedPerLanguage = new Dictionary>>>(); foreach (var command in rawTranslations) { @@ -68,6 +77,7 @@ namespace Geekbot.net.Lib.Localization } _translations = sortedPerLanguage; + // Find Languages SupportedLanguages = new List(); foreach (var lang in sortedPerLanguage) { diff --git a/Geekbot.net/Lib/Localization/Translations.json b/Geekbot.net/Lib/Localization/Translations.json deleted file mode 100644 index 689085e..0000000 --- a/Geekbot.net/Lib/Localization/Translations.json +++ /dev/null @@ -1,220 +0,0 @@ -{ - "dateTime": { - "Days": { - "EN": ["day", "days"], - "CHDE": ["tag", "täg"] - }, - "Hours": { - "EN": ["hour", "hours"], - "CHDE": ["stund", "stunde"] - }, - "Minutes": { - "EN": ["minute", "minutes"], - "CHDE": ["minute", "minute"] - }, - "Seconds": { - "EN": ["second", "seconds"], - "CHDE": ["sekunde", "sekunde"] - }, - "And": { - "EN": ["and"], - "CHDE": ["und"] - } - }, - "admin": { - "NewLanguageSet": { - "EN": ["I will reply in english from now on"], - "CHDE": ["I werd ab jetzt uf schwiizerdüütsch antworte, äuuä"] - }, - "GetLanguage": { - "EN": ["I'm talking english"], - "CHDE": ["I red schwiizerdüütsch"] - } - }, - "errorHandler": { - "SomethingWentWrong": { - "EN": ["Something went wrong :confused:"], - "CHDE": ["Öppis isch schief gange :confused:"] - } - }, - "httpErrors": { - "403": { - "EN": ["Seems like i don't have enough permission to that :confused:"], - "CHDE": ["Gseht danach us das ich nid gnueg recht han zum das mache :confused:"] - } - }, - "choose": { - "Choice": { - "EN": ["I Choose **{0}**"], - "CHDE": ["I nimme **{0}**"] - } - }, - "good": { - "CannotChangeOwn": { - "EN": ["Sorry {0}, but you can't give yourself karma"], - "CHDE": ["Sorry {0}, aber du chasch dr selber kei karma geh"] - }, - "WaitUntill": { - "EN": ["Sorry {0}, but you have to wait {1} before you can give karma again..."], - "CHDE": ["Sorry {0}, aber du musch no {1} warte bisch d wieder karma chasch geh..."] - }, - "Increased": { - "EN": ["Karma gained"], - "CHDE": ["Karma becho"] - }, - "By": { - "EN": ["By"], - "CHDE": ["Vo"] - }, - "Amount": { - "EN": ["Amount"], - "CHDE": ["Mengi"] - }, - "Current": { - "EN": ["Current"], - "CHDE": ["Jetzt"] - } - }, - "bad": { - "CannotChangeOwn": { - "EN": ["Sorry {0}, but you can't lower your own karma"], - "CHDE": ["Sorry {0}, aber du chasch dr din eigete karma nid weg neh"] - }, - "WaitUntill": { - "EN": ["Sorry {0}, but you have to wait {1} before you can lower karma again..."], - "CHDE": ["Sorry {0}, aber du musch no {1} warte bisch d wieder karma chasch senke..."] - }, - "Decreased": { - "EN": ["Karma lowered"], - "CHDE": ["Karma gsenkt"] - }, - "By": { - "EN": ["By"], - "CHDE": ["Vo"] - }, - "Amount": { - "EN": ["Amount"], - "CHDE": ["Mengi"] - }, - "Current": { - "EN": ["Current"], - "CHDE": ["Jetzt"] - } - }, - "roll": { - "Rolled": { - "EN": ["{0}, you rolled {1}, your guess was {2}"], - "CHDE": ["{0}, du hesch {1} grollt und hesch {2} grate"] - }, - "Gratz": { - "EN": ["Congratulations {0}, your guess was correct!"], - "CHDE": ["Gratuliere {0}, du hesch richtig grate!"] - }, - "RolledNoGuess": { - "EN": ["{0}, you rolled {1}"], - "CHDE": ["{0}, du hesch {1} grollt"] - }, - "NoPrevGuess": { - "EN": [":red_circle: {0}, you can't guess the same number again"], - "CHDE": [":red_circle: {0}, du chasch nid nomol es gliche rate"] - } - }, - "cookies": { - "GetCookies": { - "EN": ["You got {0} cookies, there are now {1} cookies in you cookie jar"], - "CHDE": ["Du häsch {0} guetzli becho, du häsch jetzt {1} guetzli ih dr büchse"] - }, - "WaitForMoreCookies": { - "EN": ["You already got cookies in the last 24 hours, you can have more cookies in {0}"], - "CHDE": ["Du hesch scho guetzli becho ih de letzti 24 stund, du chasch meh ha in {0}"] - }, - "InYourJar": { - "EN": ["There are {0} cookies in you cookie jar"], - "CHDE": ["Es hät {0} guetzli ih dineri büchs"] - }, - "Given": { - "EN": ["You gave {0} cookies to {1}"], - "CHDE": ["Du hesch {1} {0} guetzli geh"] - }, - "NotEnoughToGive": { - "EN": ["You don't have enough cookies"], - "CHDE": ["Du hesch nid gnueg guetzli"] - }, - "NotEnoughCookiesToEat": { - "EN": ["Your cookie jar looks almost empty, you should probably not eat a cookie"], - "CHDE": ["Du hesch chuum no guetzli ih dineri büchs, du sötsch warschinli keini esse"] - }, - "AteCookies": { - "EN": ["You ate {0} cookies, you've only got {1} cookies left"], - "CHDE": ["Du hesch {0} guetzli gesse und hesch jezt no {1} übrig"] - } - }, - "role": { - "NoRolesConfigured": { - "EN": ["There are no roles configured for this server"], - "CHDE": ["Es sind kei rolle für dä server konfiguriert"] - }, - "ListHeader": { - "EN": ["**Self Service Roles on {0}**"], - "CHDE": ["**Self Service Rollene uf {0}**"] - }, - "ListInstruction": { - "EN": ["To get a role, use `!role [name]`"], - "CHDE": ["Zum ä rolle becho, schriib `!role [name]`"] - }, - "RoleNotFound": { - "EN": ["That role doesn't exist or is not on the whitelist"], - "CHDE": ["Die rolle gids nid or isch nid uf dr whitelist"] - }, - "RemovedUserFromRole": { - "EN": ["Removed you from {0}"], - "CHDE": ["Han di entfernt vo {0}"] - }, - "AddedUserFromRole": { - "EN": ["Added you to {0}"], - "CHDE": ["Han di hinzue gfüegt zu {0}"] - }, - "CannotAddManagedRole": { - "EN": ["You can't add a role that is managed by discord"], - "CHDE": ["Du chasch kei rolle hinzuefüge wo verwalted wird vo discord"] - }, - "CannotAddDangerousRole": { - "EN": ["You cannot add that role to self service because it contains one or more dangerous permissions"], - "CHDE": ["Du chasch die rolle nid hinzuefüge will er ein oder mehreri gföhrlichi berechtigunge het"] - }, - "AddedRoleToWhitelist": { - "EN": ["Added {0} to the whitelist"], - "CHDE": ["{0} isch zur whitelist hinzuegfüegt"] - }, - "RemovedRoleFromWhitelist": { - "EN": ["Removed {0} from the whitelist"], - "CHDE": ["{0} isch vo dr whitelist glöscht"] - } - }, - "quote": { - "NoQuotesFound": { - "EN": ["This server doesn't seem to have any quotes yet. You can add a quote with `!quote save @user` or `!quote save `"], - "CHDE": ["Dä server het no kei quotes. Du chasch quotes hinzuefüege mit `!quote save @user` oder `!quote save `"] - }, - "CannotSaveOwnQuotes": { - "EN": ["You can't save your own quotes..."], - "CHDE": ["Du chasch kei quotes vo dir selber speichere..."] - }, - "CannotQuoteBots": { - "EN": ["You can't save quotes by a bot..."], - "CHDE": ["Du chasch kei quotes vomne bot speichere..."] - }, - "QuoteAdded": { - "EN": ["**Quote Added**"], - "CHDE": ["**Quote hinzugfüegt**"] - }, - "Removed": { - "EN": ["**Removed #{0}**"], - "CHDE": ["**#{0} glöscht**"] - }, - "NotFoundWithId": { - "EN": ["I couldn't find a quote with that ID :disappointed:"], - "CHDE": ["Ich chan kei quote finde mit därri ID :disappointed:"] - } - } -} \ No newline at end of file diff --git a/Geekbot.net/Lib/Localization/Translations.yml b/Geekbot.net/Lib/Localization/Translations.yml new file mode 100644 index 0000000..02e13f4 --- /dev/null +++ b/Geekbot.net/Lib/Localization/Translations.yml @@ -0,0 +1,265 @@ +--- +dateTime: + Days: + EN: + - "day" + - "days" + CHDE: + - "tag" + - "täg" + Hours: + EN: + - "hour" + - "hours" + CHDE: + - "stund" + - "stunde" + Minutes: + EN: + - "minute" + - "minutes" + CHDE: + - "minute" + - "minute" + Seconds: + EN: + - "second" + - "seconds" + CHDE: + - "sekunde" + - "sekunde" + And: + EN: + - "and" + CHDE: + - "und" +admin: + NewLanguageSet: + EN: + - "I will reply in english from now on" + CHDE: + - "I werd ab jetzt uf schwiizerdüütsch antworte, äuuä" + GetLanguage: + EN: + - "I'm talking english" + CHDE: + - "I red schwiizerdüütsch" +errorHandler: + SomethingWentWrong: + EN: + - "Something went wrong :confused:" + CHDE: + - "Öppis isch schief gange :confused:" +httpErrors: + 403: + EN: + - "Seems like i don't have enough permission to that :confused:" + CHDE: + - "Gseht danach us das ich nid gnueg recht han zum das mache :confused:" +choose: + Choice: + EN: + - "I Choose **{0}**" + CHDE: + - "I nimme **{0}**" +good: + CannotChangeOwn: + EN: + - "Sorry {0}, but you can't give yourself karma" + CHDE: + - "Sorry {0}, aber du chasch dr selber kei karma geh" + WaitUntill: + EN: + - "Sorry {0}, but you have to wait {1} before you can give karma again..." + CHDE: + - "Sorry {0}, aber du musch no {1} warte bisch d wieder karma chasch geh..." + Increased: + EN: + - "Karma gained" + CHDE: + - "Karma becho" + By: + EN: + - "By" + CHDE: + - "Vo" + Amount: + EN: + - "Amount" + CHDE: + - "Mengi" + Current: + EN: + - "Current" + CHDE: + - "Jetzt" +bad: + CannotChangeOwn: + EN: + - "Sorry {0}, but you can't lower your own karma" + CHDE: + - "Sorry {0}, aber du chasch dr din eigete karma nid weg neh" + WaitUntill: + EN: + - "Sorry {0}, but you have to wait {1} before you can lower karma again..." + CHDE: + - "Sorry {0}, aber du musch no {1} warte bisch d wieder karma chasch senke..." + Decreased: + EN: + - "Karma lowered" + CHDE: + - "Karma gsenkt" + By: + EN: + - "By" + CHDE: + - "Vo" + Amount: + EN: + - "Amount" + CHDE: + - "Mengi" + Current: + EN: + - "Current" + CHDE: + - "Jetzt" +roll: + Rolled: + EN: + - "{0}, you rolled {1}, your guess was {2}" + CHDE: + - "{0}, du hesch {1} grollt und hesch {2} grate" + Gratz: + EN: + - "Congratulations {0}, your guess was correct!" + CHDE: + - "Gratuliere {0}, du hesch richtig grate!" + RolledNoGuess: + EN: + - "{0}, you rolled {1}" + CHDE: + - "{0}, du hesch {1} grollt" + NoPrevGuess: + EN: + - ":red_circle: {0}, you can't guess the same number again" + CHDE: + - ":red_circle: {0}, du chasch nid nomol es gliche rate" +cookies: + GetCookies: + EN: + - "You got {0} cookies, there are now {1} cookies in you cookie jar" + CHDE: + - "Du häsch {0} guetzli becho, du häsch jetzt {1} guetzli ih dr büchse" + WaitForMoreCookies: + EN: + - "You already got cookies in the last 24 hours, you can have more cookies in {0}" + CHDE: + - "Du hesch scho guetzli becho ih de letzti 24 stund, du chasch meh ha in {0}" + InYourJar: + EN: + - "There are {0} cookies in you cookie jar" + CHDE: + - "Es hät {0} guetzli ih dineri büchs" + Given: + EN: + - "You gave {0} cookies to {1}" + CHDE: + - "Du hesch {1} {0} guetzli geh" + NotEnoughToGive: + EN: + - "You don't have enough cookies" + CHDE: + - "Du hesch nid gnueg guetzli" + NotEnoughCookiesToEat: + EN: + - "Your cookie jar looks almost empty, you should probably not eat a cookie" + CHDE: + - "Du hesch chuum no guetzli ih dineri büchs, du sötsch warschinli keini esse" + AteCookies: + EN: + - "You ate {0} cookies, you've only got {1} cookies left" + CHDE: + - "Du hesch {0} guetzli gesse und hesch jezt no {1} übrig" +role: + NoRolesConfigured: + EN: + - "There are no roles configured for this server" + CHDE: + - "Es sind kei rolle für dä server konfiguriert" + ListHeader: + EN: + - "**Self Service Roles on {0}**" + CHDE: + - "**Self Service Rollene uf {0}**" + ListInstruction: + EN: + - "To get a role, use `!role [name]`" + CHDE: + - "Zum ä rolle becho, schriib `!role [name]`" + RoleNotFound: + EN: + - "That role doesn't exist or is not on the whitelist" + CHDE: + - "Die rolle gids nid or isch nid uf dr whitelist" + RemovedUserFromRole: + EN: + - "Removed you from {0}" + CHDE: + - "Han di entfernt vo {0}" + AddedUserFromRole: + EN: + - "Added you to {0}" + CHDE: + - "Han di hinzue gfüegt zu {0}" + CannotAddManagedRole: + EN: + - "You can't add a role that is managed by discord" + CHDE: + - "Du chasch kei rolle hinzuefüge wo verwalted wird vo discord" + CannotAddDangerousRole: + EN: + - "You cannot add that role to self service because it contains one or more dangerous permissions" + CHDE: + - "Du chasch die rolle nid hinzuefüge will er ein oder mehreri gföhrlichi berechtigunge het" + AddedRoleToWhitelist: + EN: + - "Added {0} to the whitelist" + CHDE: + - "{0} isch zur whitelist hinzuegfüegt" + RemovedRoleFromWhitelist: + EN: + - "Removed {0} from the whitelist" + CHDE: + - "{0} isch vo dr whitelist glöscht" +quote: + NoQuotesFound: + EN: + - "This server doesn't seem to have any quotes yet. You can add a quote with `!quote save @user` or `!quote save `" + CHDE: + - "Dä server het no kei quotes. Du chasch quotes hinzuefüege mit `!quote save @user` oder `!quote save `" + CannotSaveOwnQuotes: + EN: + - "You can't save your own quotes..." + CHDE: + - "Du chasch kei quotes vo dir selber speichere..." + CannotQuoteBots: + EN: + - "You can't save quotes by a bot..." + CHDE: + - "Du chasch kei quotes vomne bot speichere..." + QuoteAdded: + EN: + - "**Quote Added**" + CHDE: + - "**Quote hinzugfüegt**" + Removed: + EN: + - "**Removed #{0}**" + CHDE: + - "**#{0} glöscht**" + NotFoundWithId: + EN: + - "I couldn't find a quote with that ID :disappointed:" + CHDE: + - "Ich chan kei quote finde mit därri ID :disappointed:" \ No newline at end of file