lib/po2icu.js
function (icuString, options) {
        icuString = this.cleanWhiteSpace(icuString);

        //args before kwargs
        if (typeof options !== 'undefined') {
            if (typeof options.string !== 'undefined') {
                var stringRe = new RegExp(('\{' + options.string + '\}'), 'g');
                icuString = icuString.replace(stringRe, '%s');
            }
            if (typeof options.number !== 'undefined') {
                var numberRe = new RegExp(('\{' + options.number + ', number\}'), 'g');
                icuString = icuString.replace(numberRe, '%d');
            }
        }

        icuString = icuString.replace(/\{[a-zA-Z0-9_.|]+\}/g, function (variable_name) {
            var name = variable_name.substring(1, (variable_name.length - 1));
            return '%(' + name + ')s';
        });
        icuString = icuString.replace(/\{[a-zA-Z0-9_.|]+, number\}/g, function (variable_name) {
            var name = variable_name.substring(1, (variable_name.length - 9));
            return '%(' + name + ')d';
        });
        return icuString;
    }
function (icuString, options) {
        icuString = this.cleanWhiteSpace(icuString);

        //args before kwargs
        if (typeof options !== 'undefined') {
            if (typeof options.string !== 'undefined') {
                var stringRe = new RegExp(('\{' + options.string + '\}'), 'g');
                icuString = icuString.replace(stringRe, '%s');
            }
            if (typeof options.number !== 'undefined') {
                var numberRe = new RegExp(('\{' + options.number + ', number\}'), 'g');
                icuString = icuString.replace(numberRe, '%d');
            }
        }

        icuString = icuString.replace(/\{[a-zA-Z0-9_.|]+\}/g, function (variable_name) {
            var name = variable_name.substring(1, (variable_name.length - 1));
            return '%(' + name + ')s';
        });
        icuString = icuString.replace(/\{[a-zA-Z0-9_.|]+, number\}/g, function (variable_name) {
            var name = variable_name.substring(1, (variable_name.length - 9));
            return '%(' + name + ')d';
        });
        return icuString;
    }
function ( icuString , options ) { icuString = this . cleanWhiteSpace ( icuString ) ; //args before kwargs if ( typeof options !== 'undefined' ) { if ( typeof options . string !== 'undefined' ) { var stringRe = new RegExp ( ( '\{' + options . string + '\}' ) , 'g' ) ; icuString = icuString . replace ( stringRe , '%s' ) ; } if ( typeof options . number !== 'undefined' ) { var numberRe = new RegExp ( ( '\{' + options . number + ', number\}' ) , 'g' ) ; icuString = icuString . replace ( numberRe , '%d' ) ; } } icuString = icuString . replace ( / \{[a-zA-Z0-9_.|]+\} / g , function ( variable_name ) { var name = variable_name . substring ( 1 , ( variable_name . length - 1 ) ) ; return '%(' + name + ')s' ; } ) ; icuString = icuString . replace ( / \{[a-zA-Z0-9_.|]+, number\} / g , function ( variable_name ) { var name = variable_name . substring ( 1 , ( variable_name . length - 9 ) ) ; return '%(' + name + ')d' ; } ) ; return icuString ; }
Converts an icu-formatted string into a po-formatted one for pytho
@param  {string} icuString   icu-formatted string
@param {object} options      gives icu keywords that should be turned into
python args in po rather than python kwargs.
Possible keys to use: `string`, `number`.
@return {string}             po-formatted string
Converts an icu - formatted string into a po - formatted one for pytho