ciyidogan commited on
Commit
c78df6c
·
verified ·
1 Parent(s): ab02886

Update flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.ts

Browse files
flare-ui/src/app/dialogs/intent-edit-dialog/intent-edit-dialog.component.ts CHANGED
@@ -83,8 +83,8 @@ export default class IntentEditDialogComponent implements OnInit {
83
  @Inject(MAT_DIALOG_DATA) public data: any
84
  ) {
85
  this.availableAPIs = data.apis || [];
86
- this.supportedLocales = data.supportedLocales || ['tr'];
87
- this.selectedExampleLocale = data.defaultLocale || this.supportedLocales[0] || 'tr';
88
  }
89
 
90
  ngOnInit() {
@@ -259,7 +259,7 @@ export default class IntentEditDialogComponent implements OnInit {
259
  if (!captions || captions.length === 0) return '(No caption)';
260
 
261
  // Try to find caption for default locale
262
- const defaultCaption = captions.find(c => c.locale_code === (this.data.defaultLocale || 'tr'));
263
  if (defaultCaption) return defaultCaption.caption;
264
 
265
  // Return first available caption
@@ -278,7 +278,7 @@ export default class IntentEditDialogComponent implements OnInit {
278
  data: {
279
  captions: [...currentCaptions],
280
  supportedLocales: this.supportedLocales,
281
- defaultLocale: this.data.defaultLocale
282
  }
283
  });
284
 
@@ -318,7 +318,7 @@ export default class IntentEditDialogComponent implements OnInit {
318
  if (!param.caption || param.caption.length === 0) {
319
  // Create default caption if missing
320
  param.caption = [{
321
- locale_code: this.data.defaultLocale || 'tr',
322
  caption: param.name
323
  }];
324
  }
 
83
  @Inject(MAT_DIALOG_DATA) public data: any
84
  ) {
85
  this.availableAPIs = data.apis || [];
86
+ this.supportedLocales = data.project?.supported_locales || data.supportedLocales || ['tr'];
87
+ this.selectedExampleLocale = data.project?.default_locale || data.defaultLocale || this.supportedLocales[0] || 'tr';
88
  }
89
 
90
  ngOnInit() {
 
259
  if (!captions || captions.length === 0) return '(No caption)';
260
 
261
  // Try to find caption for default locale
262
+ const defaultCaption = captions.find(c => c.locale_code === (this.data.project?.default_locale || this.data.defaultLocale || 'tr'));
263
  if (defaultCaption) return defaultCaption.caption;
264
 
265
  // Return first available caption
 
278
  data: {
279
  captions: [...currentCaptions],
280
  supportedLocales: this.supportedLocales,
281
+ defaultLocale: this.data.project?.default_locale || this.data.defaultLocale
282
  }
283
  });
284
 
 
318
  if (!param.caption || param.caption.length === 0) {
319
  // Create default caption if missing
320
  param.caption = [{
321
+ locale_code: this.data.project?.default_locale || this.data.defaultLocale || 'tr',
322
  caption: param.name
323
  }];
324
  }