function findString(msgPath, opts) {
        const options = merge({log: true}, opts || {});
        let candidateString, matchingString, path;

        // no path? no string
        if (msgPath.length === 0 || !isString(msgPath)) {
            chalk.yellow('i18n.t() - received an empty path.');
            return '';
        }

        // If not in memory, load translations for core
        if (coreStrings === undefined) {
            I18n.init();
        }

        if (options.isThemeString) {
            // If not in memory, load translations for theme
            if (themeStrings === undefined) {
                I18n.loadThemeTranslations();
            }
            // Both jsonpath's dot-notation and bracket-notation start with '$'
            // E.g.: $.store.book.title or $['store']['book']['title']
            // The {{t}} translation helper passes the default English text
            // The full Unicode jsonpath with '$' is built here
            // jp.stringify and jp.value are jsonpath methods
            // Info: https://www.npmjs.com/package/jsonpath
            path = jp.stringify(['$', msgPath]);
            candidateString = jp.value(themeStrings, path) || msgPath;
        } else {
            // Backend messages use dot-notation, and the '$.' prefix is added here
            // While bracket-notation allows any Unicode characters in keys for themes,
            // dot-notation allows only word characters in keys for backend messages
            // (that is \w or [A-Za-z0-9_] in RegExp)
            path = `$.${msgPath}`;
            candidateString = jp.value(coreStrings, path);
        }

        matchingString = candidateString || {};

        if (isObject(matchingString) || isEqual(matchingString, {})) {
            if (options.log) {
                logging.error(new errors.IncorrectUsageError({
                    message: `i18n error: path "${msgPath}" was not found`
                }));
            }

            matchingString = coreStrings.errors.errors.anErrorOccurred;
        }

        return matchingString;
    }
function findString(msgPath, opts) {
        const options = merge({log: true}, opts || {});
        let candidateString, matchingString, path;

        // no path? no string
        if (msgPath.length === 0 || !isString(msgPath)) {
            chalk.yellow('i18n.t() - received an empty path.');
            return '';
        }

        // If not in memory, load translations for core
        if (coreStrings === undefined) {
            I18n.init();
        }

        if (options.isThemeString) {
            // If not in memory, load translations for theme
            if (themeStrings === undefined) {
                I18n.loadThemeTranslations();
            }
            // Both jsonpath's dot-notation and bracket-notation start with '$'
            // E.g.: $.store.book.title or $['store']['book']['title']
            // The {{t}} translation helper passes the default English text
            // The full Unicode jsonpath with '$' is built here
            // jp.stringify and jp.value are jsonpath methods
            // Info: https://www.npmjs.com/package/jsonpath
            path = jp.stringify(['$', msgPath]);
            candidateString = jp.value(themeStrings, path) || msgPath;
        } else {
            // Backend messages use dot-notation, and the '$.' prefix is added here
            // While bracket-notation allows any Unicode characters in keys for themes,
            // dot-notation allows only word characters in keys for backend messages
            // (that is \w or [A-Za-z0-9_] in RegExp)
            path = `$.${msgPath}`;
            candidateString = jp.value(coreStrings, path);
        }

        matchingString = candidateString || {};

        if (isObject(matchingString) || isEqual(matchingString, {})) {
            if (options.log) {
                logging.error(new errors.IncorrectUsageError({
                    message: `i18n error: path "${msgPath}" was not found`
                }));
            }

            matchingString = coreStrings.errors.errors.anErrorOccurred;
        }

        return matchingString;
    }
function findString ( msgPath , opts ) { const options = merge ( { log : true } , opts || { } ) ; let candidateString , matchingString , path ; // no path? no string if ( msgPath . length === 0 || ! isString ( msgPath ) ) { chalk . yellow ( 'i18n.t() - received an empty path.' ) ; return '' ; } // If not in memory, load translations for core if ( coreStrings === undefined ) { I18n . init ( ) ; } if ( options . isThemeString ) { // If not in memory, load translations for theme if ( themeStrings === undefined ) { I18n . loadThemeTranslations ( ) ; } // Both jsonpath's dot-notation and bracket-notation start with '$' // E.g.: $.store.book.title or $['store']['book']['title'] // The {{t}} translation helper passes the default English text // The full Unicode jsonpath with '$' is built here // jp.stringify and jp.value are jsonpath methods // Info: https://www.npmjs.com/package/jsonpath path = jp . stringify ( [ '$' , msgPath ] ) ; candidateString = jp . value ( themeStrings , path ) || msgPath ; } else { // Backend messages use dot-notation, and the '$.' prefix is added here // While bracket-notation allows any Unicode characters in keys for themes, // dot-notation allows only word characters in keys for backend messages // (that is \w or [A-Za-z0-9_] in RegExp) path = ` ${ msgPath } ` ; candidateString = jp . value ( coreStrings , path ) ; } matchingString = candidateString || { } ; if ( isObject ( matchingString ) || isEqual ( matchingString , { } ) ) { if ( options . log ) { logging . error ( new errors . IncorrectUsageError ( { message : ` ${ msgPath } ` } ) ) ; } matchingString = coreStrings . errors . errors . anErrorOccurred ; } return matchingString ; }
Parse JSON file for matching locale, returns string giving path.

@param {string} msgPath Path with in the JSON language file to desired string (ie: "errors.init.jsNotBuilt")
@returns {string}
Parse JSON file for matching locale returns string giving path .
Find a string from the i18n file