vime icon indicating copy to clipboard operation
vime copied to clipboard

i18n not working

Open Adrii77 opened this issue 2 years ago • 1 comments

Hello,

After reading the i18n's documentation, the (audio) player still contains english labels.

My code : Component's class :

const fr: Translation = {
  ... // some french translations
};

@Component({
  selector: 'app-player',
  templateUrl: './player.component.html',
  styleUrls: ['./player.component.scss'],
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class PlayerComponent {
  translations = { fr };
}

Component's template :

<vm-player
  language="fr"
  [translations]="translations">
  <vm-audio>
    <source
      [attr.data-src]="........."
      type="audio/mp3" />
  </vm-audio>

    <vm-default-ui></vm-default-ui>
</vm-player>

I also tried to use the second option with "extendLanguage" method, but same issue.

Versions : Angular : 13.2.5 "@vime/angular": "^5.3.1", "@vime/core": "^5.3.1",

Adrii77 avatar Mar 21 '22 11:03 Adrii77

Ok, it works know, but I think there is a bug on player initialization. The issue is caused by the "language" input which ignores any assigned value from the template.

It finally worked by setting language inside my component's class, in the callback function call when "vmReady" emit.

<vm-player (vmReady)="ready()" [translations]="translations">
  <vm-audio>
    <source
      [attr.data-src]="........."
      type="audio/mp3" />
  </vm-audio>

    <vm-default-ui></vm-default-ui>
</vm-player>
export class PlayerComponent {
  @ViewChild(Player) private player!: Player;
  readonly translations = { fr };

  constructor(private readonly playerService: PlayerService) {}

  ready(): void {
    this.player.language = 'fr';
  }
} 

I didn't close the issue because the default language assignation from the template input should works.

Adrii77 avatar Mar 21 '22 14:03 Adrii77