mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-19 20:32:01 +00:00
Swkbd Applet Fixes (#5236)
* Swkbd Applet Fixes * Forgot a full stop * Update src/Ryujinx.Ava/UI/Applet/SwkbdAppletDialog.axaml.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> * Update src/Ryujinx/Ui/Applet/SwkbdAppletDialog.cs Co-authored-by: Ac_K <Acoustik666@gmail.com> --------- Co-authored-by: Ac_K <Acoustik666@gmail.com>
This commit is contained in:
parent
86de288142
commit
2bf4555591
5 changed files with 34 additions and 9 deletions
|
@ -545,7 +545,7 @@
|
|||
"SwkbdMinRangeCharacters": "Must be {0}-{1} characters long",
|
||||
"SoftwareKeyboard": "Software Keyboard",
|
||||
"SoftwareKeyboardModeNumbersOnly": "Must be numbers only",
|
||||
"SoftwareKeyboardModeAlphabet": "Must be alphabets only",
|
||||
"SoftwareKeyboardModeAlphabet": "Must be non CJK-characters only",
|
||||
"SoftwareKeyboardModeASCII": "Must be ASCII text only",
|
||||
"DialogControllerAppletMessagePlayerRange": "Application requests {0} player(s) with:\n\nTYPES: {1}\n\nPLAYERS: {2}\n\n{3}Please open Settings and reconfigure Input now or press Close.",
|
||||
"DialogControllerAppletMessage": "Application requests exactly {0} player(s) with:\n\nTYPES: {1}\n\nPLAYERS: {2}\n\n{3}Please open Settings and reconfigure Input now or press Close.",
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace Ryujinx.Ava.UI.Controls
|
|||
case KeyboardMode.Alphabet:
|
||||
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeAlphabet);
|
||||
validationInfoText = string.IsNullOrEmpty(validationInfoText) ? localeText : string.Join("\n", validationInfoText, localeText);
|
||||
_checkInput = text => text.All(char.IsAsciiLetter);
|
||||
_checkInput = text => text.All(value => !CJKCharacterValidation.IsCJK(value));
|
||||
break;
|
||||
case KeyboardMode.ASCII:
|
||||
localeText = LocaleManager.Instance.UpdateAndGetDynamicValue(LocaleKeys.SoftwareKeyboardModeASCII);
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace Ryujinx.HLE.HOS.Applets.SoftwareKeyboard
|
||||
{
|
||||
public static partial class CJKCharacterValidation
|
||||
{
|
||||
public static bool IsCJK(char value)
|
||||
{
|
||||
Regex regex = CJKRegex();
|
||||
|
||||
return regex.IsMatch(value.ToString());
|
||||
}
|
||||
|
||||
[GeneratedRegex("\\p{IsHangulJamo}|\\p{IsCJKRadicalsSupplement}|\\p{IsCJKSymbolsandPunctuation}|\\p{IsEnclosedCJKLettersandMonths}|\\p{IsCJKCompatibility}|\\p{IsCJKUnifiedIdeographsExtensionA}|\\p{IsCJKUnifiedIdeographs}|\\p{IsHangulSyllables}|\\p{IsCJKCompatibilityForms}")]
|
||||
private static partial Regex CJKRegex();
|
||||
}
|
||||
}
|
|
@ -6,22 +6,30 @@
|
|||
public enum KeyboardMode : uint
|
||||
{
|
||||
/// <summary>
|
||||
/// A full alpha-numeric keyboard.
|
||||
/// All UTF-16 characters allowed.
|
||||
/// </summary>
|
||||
Default = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Number pad.
|
||||
/// Only numbers allowed.
|
||||
/// </summary>
|
||||
NumbersOnly = 1,
|
||||
|
||||
/// <summary>
|
||||
/// ASCII characters keyboard.
|
||||
/// Only ASCII characters allowed.
|
||||
/// </summary>
|
||||
ASCII = 2,
|
||||
|
||||
FullLatin = 3,
|
||||
Alphabet = 4,
|
||||
/// <summary>
|
||||
/// Synonymous with default.
|
||||
/// </summary>
|
||||
FullLatin = 3,
|
||||
|
||||
/// <summary>
|
||||
/// All UTF-16 characters except CJK characters allowed.
|
||||
/// </summary>
|
||||
Alphabet = 4,
|
||||
|
||||
SimplifiedChinese = 5,
|
||||
TraditionalChinese = 6,
|
||||
Korean = 7,
|
||||
|
|
|
@ -93,8 +93,8 @@ namespace Ryujinx.Ui.Applet
|
|||
_checkInput = text => text.All(char.IsDigit);
|
||||
break;
|
||||
case KeyboardMode.Alphabet:
|
||||
_validationInfoText += "<i>Must be alphabets only.</i>";
|
||||
_checkInput = text => text.All(char.IsAsciiLetter);
|
||||
_validationInfoText += "<i>Must be non CJK-characters only.</i>";
|
||||
_checkInput = text => text.All(value => !CJKCharacterValidation.IsCJK(value));
|
||||
break;
|
||||
case KeyboardMode.ASCII:
|
||||
_validationInfoText += "<i>Must be ASCII text only.</i>";
|
||||
|
|
Loading…
Reference in a new issue