dist/vuex-i18n.es.js
function render(locale, translation) {
    var replacements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    var pluralization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

    // get the type of the property
    var objType = _typeof(translation);

    var pluralizationType = _typeof(pluralization);

    var resolvePlaceholders = function resolvePlaceholders() {
      if (isArray$1(translation)) {
        // replace the placeholder elements in all sub-items
        return translation.map(function (item) {
          return replace(item, replacements, false);
        });
      } else if (objType === 'string') {
        return replace(translation, replacements, true);
      }
    }; // return translation item directly


    if (pluralization === null) {
      return resolvePlaceholders();
    } // check if pluralization value is countable


    if (pluralizationType !== 'number') {
      if (warnings) console.warn('i18n: pluralization is not a number');
      return resolvePlaceholders();
    } // --- handle pluralizations ---
    // replace all placeholders


    var resolvedTranslation = resolvePlaceholders(); // initialize pluralizations

    var pluralizations = null; // if translations are already an array and have more than one entry,
    // we will not perform a split operation on :::

    if (isArray$1(resolvedTranslation) && resolvedTranslation.length > 0) {
      pluralizations = resolvedTranslation;
    } else {
      // split translation strings by ::: to find create the pluralization array
      pluralizations = resolvedTranslation.split(':::');
    } // determine the pluralization version to use by locale


    var index = plurals.getTranslationIndex(locale, pluralization); // check if the specified index is present in the pluralization

    if (typeof pluralizations[index] === 'undefined') {
      if (warnings) {
        console.warn('i18n: pluralization not provided in locale', translation, locale, index);
      } // return the first element of the pluralization by default


      return pluralizations[0].trim();
    } // return the requested item from the pluralizations


    return pluralizations[index].trim();
  }
function render(locale, translation) {
    var replacements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
    var pluralization = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;

    // get the type of the property
    var objType = _typeof(translation);

    var pluralizationType = _typeof(pluralization);

    var resolvePlaceholders = function resolvePlaceholders() {
      if (isArray$1(translation)) {
        // replace the placeholder elements in all sub-items
        return translation.map(function (item) {
          return replace(item, replacements, false);
        });
      } else if (objType === 'string') {
        return replace(translation, replacements, true);
      }
    }; // return translation item directly


    if (pluralization === null) {
      return resolvePlaceholders();
    } // check if pluralization value is countable


    if (pluralizationType !== 'number') {
      if (warnings) console.warn('i18n: pluralization is not a number');
      return resolvePlaceholders();
    } // --- handle pluralizations ---
    // replace all placeholders


    var resolvedTranslation = resolvePlaceholders(); // initialize pluralizations

    var pluralizations = null; // if translations are already an array and have more than one entry,
    // we will not perform a split operation on :::

    if (isArray$1(resolvedTranslation) && resolvedTranslation.length > 0) {
      pluralizations = resolvedTranslation;
    } else {
      // split translation strings by ::: to find create the pluralization array
      pluralizations = resolvedTranslation.split(':::');
    } // determine the pluralization version to use by locale


    var index = plurals.getTranslationIndex(locale, pluralization); // check if the specified index is present in the pluralization

    if (typeof pluralizations[index] === 'undefined') {
      if (warnings) {
        console.warn('i18n: pluralization not provided in locale', translation, locale, index);
      } // return the first element of the pluralization by default


      return pluralizations[0].trim();
    } // return the requested item from the pluralizations


    return pluralizations[index].trim();
  }
function render ( locale , translation ) { var replacements = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : { } ; var pluralization = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : null ; // get the type of the property var objType = _typeof ( translation ) ; var pluralizationType = _typeof ( pluralization ) ; var resolvePlaceholders = function resolvePlaceholders ( ) { if ( isArray$1 ( translation ) ) { // replace the placeholder elements in all sub-items return translation . map ( function ( item ) { return replace ( item , replacements , false ) ; } ) ; } else if ( objType === 'string' ) { return replace ( translation , replacements , true ) ; } } ; // return translation item directly if ( pluralization === null ) { return resolvePlaceholders ( ) ; } // check if pluralization value is countable if ( pluralizationType !== 'number' ) { if ( warnings ) console . warn ( 'i18n: pluralization is not a number' ) ; return resolvePlaceholders ( ) ; } // --- handle pluralizations --- // replace all placeholders var resolvedTranslation = resolvePlaceholders ( ) ; // initialize pluralizations var pluralizations = null ; // if translations are already an array and have more than one entry, // we will not perform a split operation on ::: if ( isArray$1 ( resolvedTranslation ) && resolvedTranslation . length > 0 ) { pluralizations = resolvedTranslation ; } else { // split translation strings by ::: to find create the pluralization array pluralizations = resolvedTranslation . split ( ':::' ) ; } // determine the pluralization version to use by locale var index = plurals . getTranslationIndex ( locale , pluralization ) ; // check if the specified index is present in the pluralization if ( typeof pluralizations [ index ] === 'undefined' ) { if ( warnings ) { console . warn ( 'i18n: pluralization not provided in locale' , translation , locale , index ) ; } // return the first element of the pluralization by default return pluralizations [ 0 ] . trim ( ) ; } // return the requested item from the pluralizations return pluralizations [ index ] . trim ( ) ; }
the render function will replace variable substitutions and prepare the translations for rendering
the render function will replace variable substitutions and prepare the translations for rendering