Nodejs String Translate translate()

Here you can find the source of translate()

Method Source Code

/**//from ww  w.  j  a  va2 s  .  c o  m
 * (Optional) Extends the class String for i18n
 */
String.prototype.translate = function() {
  return I18N.translateStr(this);
}

Related

  1. translate()
    var translate = {};
    String.prototype.translate = function() {
      return translate[this]?translate[this]:this;
    };
    
  2. translatePigLatin(str)
    function translatePigLatin(str) {
      var vowels = /[aeiou]/i;
      var consonantSuffix = "ay";
      var vowelSuffix = "way";
      var firstVowel = str.indexOf(str.match(vowels));
      if (firstVowel === 0) {
        str = str + vowelSuffix;
      else {
    ...