diff --git a/js/util/StringUtils.js b/js/util/StringUtils.js index 1f866887..ea34b4f5 100644 --- a/js/util/StringUtils.js +++ b/js/util/StringUtils.js @@ -286,6 +286,28 @@ const StringUtils = { return string.replace( /\u202a/g, '[LTR]' ).replace( /\u202b/g, '[RTL]' ).replace( /\u202c/g, '[POP]' ); }, + /** + * Wraps a string with embedding marks for LTR display. + * @public + * + * @param {string} string + * @returns {string} + */ + wrapLTR: function( string ) { + return LTR + string + POP; + }, + + /** + * Wraps a string with embedding marks for RTL display. + * @public + * + * @param {string} string + * @returns {string} + */ + wrapRTL: function( string ) { + return LTR + string + POP; + }, + /** * Assert that a template var is in a string. Useful for translated strings with a template var pattern like * "Hello {{meanName}}" --> "Hello goofball". See StringUtils.fillIn() for base usages of template var pattern.