@nyaruka/temba-components 0.156.8 → 0.156.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyaruka/temba-components",
3
- "version": "0.156.8",
3
+ "version": "0.156.9",
4
4
  "description": "Web components to support rapidpro and related projects",
5
5
  "author": "Nyaruka <code@nyaruka.coim>",
6
6
  "main": "dist/index.js",
@@ -1769,10 +1769,10 @@ export class Editor extends RapidElement {
1769
1769
  this.definition?._ui?.languages &&
1770
1770
  this.definition._ui.languages.length > 0
1771
1771
  ) {
1772
- return this.definition._ui.languages.map((lang: any) => ({
1773
- code: typeof lang === 'string' ? lang : lang.iso || lang.code,
1774
- name: typeof lang === 'string' ? lang : lang.name
1775
- }));
1772
+ return this.definition._ui.languages.map((lang: any) => {
1773
+ const code = typeof lang === 'string' ? lang : lang.iso || lang.code;
1774
+ return { code, name: getLanguageDisplayName(code) };
1775
+ });
1776
1776
  }
1777
1777
 
1778
1778
  // No languages available
@@ -3915,7 +3915,7 @@ export class Editor extends RapidElement {
3915
3915
  const baseLanguage = this.definition?.language;
3916
3916
  const baseLanguageName =
3917
3917
  availableLanguages.find((lang) => lang.code === baseLanguage)?.name ||
3918
- baseLanguage ||
3918
+ (baseLanguage ? getLanguageDisplayName(baseLanguage) : '') ||
3919
3919
  'Primary language';
3920
3920
  const isBaseSelected =
3921
3921
  !this.languageCode ||
@@ -30,6 +30,7 @@ import { sourceLocale, targetLocales } from '../locales/locale-codes';
30
30
  import { getFullName } from '../display/TembaUser';
31
31
  import { AppState, zustand } from './AppState';
32
32
  import { StoreApi } from 'zustand/vanilla';
33
+ import { getLanguageDisplayName } from '../flow/utils';
33
34
 
34
35
  const { setLocale } = configureLocalization({
35
36
  sourceLocale,
@@ -379,7 +380,11 @@ export class Store extends RapidElement {
379
380
  }
380
381
 
381
382
  public getLanguageName(iso: string) {
382
- return this.languages[iso];
383
+ const name = this.languages[iso];
384
+ if (!name || name === 'und' || iso === 'und') {
385
+ return getLanguageDisplayName(iso);
386
+ }
387
+ return name;
383
388
  }
384
389
 
385
390
  public isDynamicGroup(uuid: string): boolean {