mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-17 01:13:05 +00:00
move CultureInfo to QSBLocalization
This commit is contained in:
parent
85a405b5f2
commit
4ca096ba71
@ -1,6 +1,7 @@
|
||||
using QSB.Utility;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
|
||||
@ -52,4 +53,28 @@ public static class QSBLocalization
|
||||
Current = newTranslation;
|
||||
LanguageChanged?.Invoke();
|
||||
}
|
||||
|
||||
public static CultureInfo CultureInfo
|
||||
=> Current.Language switch
|
||||
{
|
||||
/*
|
||||
* Language tags from BCP-47 standard, implemented by windows
|
||||
* https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
|
||||
* I have no fucking idea if this will work on linux. ¯\_(ツ)_/¯
|
||||
*/
|
||||
|
||||
TextTranslation.Language.ENGLISH => new CultureInfo("en"),
|
||||
TextTranslation.Language.SPANISH_LA => new CultureInfo("es-419"),
|
||||
TextTranslation.Language.GERMAN => new CultureInfo("de"),
|
||||
TextTranslation.Language.FRENCH => new CultureInfo("fr"),
|
||||
TextTranslation.Language.ITALIAN => new CultureInfo("it"),
|
||||
TextTranslation.Language.POLISH => new CultureInfo("pl"),
|
||||
TextTranslation.Language.PORTUGUESE_BR => new CultureInfo("pt-BR"),
|
||||
TextTranslation.Language.JAPANESE => new CultureInfo("ja"),
|
||||
TextTranslation.Language.RUSSIAN => new CultureInfo("ru"),
|
||||
TextTranslation.Language.CHINESE_SIMPLE => new CultureInfo("zh-Hans"),
|
||||
TextTranslation.Language.KOREAN => new CultureInfo("ko"),
|
||||
TextTranslation.Language.TURKISH => new CultureInfo("tr"),
|
||||
_ => new CultureInfo("en") // what
|
||||
};
|
||||
}
|
||||
|
@ -1,6 +1,5 @@
|
||||
using QSB.Localisation;
|
||||
using QSB.ShipSync;
|
||||
using QSB.Utility;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QSB.RespawnSync;
|
||||
@ -13,7 +12,7 @@ public class RespawnHUDMarker : HUDDistanceMarker
|
||||
{
|
||||
_markerRadius = 0.2f;
|
||||
_markerTarget = transform;
|
||||
_markerLabel = QSBLocalization.Current.RespawnPlayer.ToUpper(UIHelper.GetCurrentCultureInfo());
|
||||
_markerLabel = QSBLocalization.Current.RespawnPlayer.ToUpper(QSBLocalization.CultureInfo);
|
||||
_isReady = true;
|
||||
|
||||
base.InitCanvasMarker();
|
||||
|
@ -1,6 +1,4 @@
|
||||
using QSB.Localisation;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
|
||||
namespace QSB.Utility;
|
||||
|
||||
@ -21,28 +19,4 @@ internal static class UIHelper
|
||||
DebugLog.DebugWrite($"Added text \"{text}\" to the UI table with index {key}");
|
||||
return (UITextType)key;
|
||||
}
|
||||
|
||||
public static CultureInfo GetCurrentCultureInfo()
|
||||
=> QSBLocalization.Current.Language switch
|
||||
{
|
||||
/*
|
||||
* Language tags from BCP-47 standard, implemented by windows
|
||||
* https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-lcid/a9eac961-e77d-41a6-90a5-ce1a8b0cdb9c
|
||||
* I have no fucking idea if this will work on linux. ¯\_(ツ)_/¯
|
||||
*/
|
||||
|
||||
TextTranslation.Language.ENGLISH => new CultureInfo("en"),
|
||||
TextTranslation.Language.SPANISH_LA => new CultureInfo("es-419"),
|
||||
TextTranslation.Language.GERMAN => new CultureInfo("de"),
|
||||
TextTranslation.Language.FRENCH => new CultureInfo("fr"),
|
||||
TextTranslation.Language.ITALIAN => new CultureInfo("it"),
|
||||
TextTranslation.Language.POLISH => new CultureInfo("pl"),
|
||||
TextTranslation.Language.PORTUGUESE_BR => new CultureInfo("pt-BR"),
|
||||
TextTranslation.Language.JAPANESE => new CultureInfo("ja"),
|
||||
TextTranslation.Language.RUSSIAN => new CultureInfo("ru"),
|
||||
TextTranslation.Language.CHINESE_SIMPLE => new CultureInfo("zh-Hans"),
|
||||
TextTranslation.Language.KOREAN => new CultureInfo("ko"),
|
||||
TextTranslation.Language.TURKISH => new CultureInfo("tr"),
|
||||
_ => new CultureInfo("en") // what
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user