Implemented GetRandomTextThatMatchesPartialKey
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using SptCommon.Annotations;
|
||||
using Core.Models.Spt.Config;
|
||||
using Core.Models.Utils;
|
||||
@@ -154,4 +154,9 @@ public class LocaleService(
|
||||
{
|
||||
return CultureInfo.InstalledUICulture;
|
||||
}
|
||||
|
||||
public List<string> GetLocaleKeysThatStartsWithValue(string partialKey)
|
||||
{
|
||||
return GetLocaleDb().Keys.Where(x => x.StartsWith(partialKey)).ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,9 @@ public class LocalisationService
|
||||
|
||||
public string GetRandomTextThatMatchesPartialKey(string partialKey)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var values = _localeService.GetLocaleKeysThatStartsWithValue(partialKey);
|
||||
var chosenKey = _randomUtil.GetArrayValue(values);
|
||||
|
||||
return GetText(chosenKey);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user