src/components/getLocalizedName.js
function getOfficialLangName(wofData, langProperty) {
  var languages = wofData.properties[langProperty];

  // convert to array in case it is just a string
  if (!(languages instanceof Array)) {
    languages = [languages];
  }

  if (languages.length > 1) {
    logger.silly(`more than one ${langProperty} specified`,
      wofData.properties['wof:lang_x_official'], languages);
  }

  // for now always just grab the first language in the array
  return `name:${languages[0]}_x_preferred`;
}
function getOfficialLangName(wofData, langProperty) {
  var languages = wofData.properties[langProperty];

  // convert to array in case it is just a string
  if (!(languages instanceof Array)) {
    languages = [languages];
  }

  if (languages.length > 1) {
    logger.silly(`more than one ${langProperty} specified`,
      wofData.properties['wof:lang_x_official'], languages);
  }

  // for now always just grab the first language in the array
  return `name:${languages[0]}_x_preferred`;
}
function getOfficialLangName ( wofData , langProperty ) { var languages = wofData . properties [ langProperty ] ; // convert to array in case it is just a string if ( ! ( languages instanceof Array ) ) { languages = [ languages ] ; } if ( languages . length > 1 ) { logger . silly ( ` ${ langProperty } ` , wofData . properties [ 'wof:lang_x_official' ] , languages ) ; } // for now always just grab the first language in the array return ` ${ languages [ 0 ] } ` ; }
Returns the property name of the name to be used
according to the language specification

example:
if wofData[langProperty] === ['rus']
then return 'name:rus_x_preferred'

example with multiple values:
if wofData[langProperty] === ['rus','ukr','eng']
then return 'name:rus_x_preferred'

@param {object} wofData
@param {string} langProperty
@returns {string}
Returns the property name of the name to be used according to the language specification