private static _getTextField()

in src/tms_service.ts [270:290]


  private static _getTextField(
    label: string,
    lang: string
  ): DataDrivenPropertyValueSpecification<string> {
    // Capture {name:xx} labels
    const labelMatch = label.match(/\{name([:_])(.{2})\}/);
    if (labelMatch && labelMatch[1] != lang) {
      // Only apply if the languages are different
      return ['coalesce', ['get', `name:${lang}`], ['get', `name${labelMatch[1]}${labelMatch[2]}`]];
    } else if (label.includes('latin') && label.includes('nonlatin')) {
      // Capture the common pattern {name:latin}\n{name:nonlatin}
      return [
        'coalesce',
        ['get', `name:${lang}`],
        ['concat', ['get', 'name:latin'], '\n', ['get', 'name:nonlatin']],
      ];
    }

    // If no case is found, return the input label
    return label;
  }