Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

i18n plugin not loaded in scene using TypeScript template: I18nScene.ts #43

Open
raimon-segura opened this issue Jun 2, 2020 · 0 comments

Comments

@raimon-segura
Copy link

Hi!,

Expected Behavior

When I use this plugin with a TypeScript template it doesn't load the "i18n" in Scene and shows a console error, but the game works.

Current Behavior

It doesn't translate any text if I create a new text object usign: "this.add.text()" :
this.add
this.text(this.cameras.main.width - 15, 40, "word-hello-key")

, but it works if I extend the Phaser.GameObjects.Text class:

export default class FpsText extends Phaser.GameObjects.Text {
  constructor(scene: Phaser.Scene) {
    super(scene, 10, 10, "word-hello-key")
    scene.add.existing(this)
  }
}

TypeScript template:
https://github.com/yandeu/phaser-project-template

console error:
phaser3-template-typescript/src/scripts/scenes/mainScene.ts
./src/scripts/scenes/mainScene.ts
[tsl] ERROR in phaser3-template-typescript/src/scripts/scenes/mainScene.ts(13,10)
TS2339: Property 'i18n' does not exist on type 'MainScene'.

Possible Solution

Maybe I have to load in another way?

Steps to Reproduce (for bugs)

To reproduce just clone this template, https://github.com/yandeu/phaser-project-template , then follow the plugin steps:
1- install plugin npm i --save @koreez/phaser3-i18n
2- import & load plugin in game.ts (add import & plugins.scene into configuration)
3- initialize plugin in

Your Environment

Linux, Chrome Version 83.0.4103.61

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant