Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Oct 4, 2024
2 parents 234a62c + 56257b8 commit 1ac8355
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions haxe/ui/locale/LocaleManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,22 @@ class LocaleManager {
return translateTo(language, id, param0, param1, param2, param3);
}

/**
To use a translation unattached to a component
**/
public function stringToTranslation(s:String):String {
var fixedExpr = ExpressionUtil.stringToLanguageExpression(s, "LocaleManager");
if (StringTools.endsWith(fixedExpr, ";") == true) {
fixedExpr = fixedExpr.substr(0, fixedExpr.length - 1);
}
var context = {
LocaleManager: LocaleManager,
MathUtil: MathUtil
};
var value = SimpleExpressionEvaluator.eval(fixedExpr, context);
return value;
}

private var _localeStringMap:Map<String, Map<String, LocaleString>> = new Map<String, Map<String, LocaleString>>();
public function translateTo(lang:String, id:String, param0:Any = null, param1:Any = null, param2:Any = null, param3:Any = null) {
lang = StringTools.replace(lang, "-", "_");
Expand Down
2 changes: 1 addition & 1 deletion haxe/ui/validators/EmailValidator.hx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class EmailValidator extends PatternValidator {
public function new() {
super();
invalidMessage = "Invalid email address";
pattern = ~/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/gm;
pattern = ~/^[^\-@\s:&!\/\\]+([\.-]?[^@\s:&!\/\\]+)*@[^\-@\s:&!\/\\\.]+([\.-]?[^@\s:&!\/\\\.]+)*(\.[^\-@\s:&!\/\\\.]{2,})+$/gm;
//pattern = new EReg("^\\w+([\\.-]?\\w+)*@\\w+([\\.-]?\\w+)*(\\.\\w{2,3})+$", "gm");
}
}

0 comments on commit 1ac8355

Please sign in to comment.