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

Add i18n to ASK CLI 2.0.x template #46

Open
wants to merge 1 commit into
base: ask-cli-x
Choose a base branch
from

Conversation

habuma
Copy link

@habuma habuma commented Apr 12, 2020

Description of changes:

Add support for i18n resolution of messages as in the master template.

Note that although I've given this a rough test, it involved some manual testing steps for reasons described in alexa/ask-cli#118. I think that this PR is correct as-is, but because I had to do some manual tweaking to test it, I acknowledge that there may be some missing bits that were covered up by the manual steps I took to test.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@habuma
Copy link
Author

habuma commented Apr 13, 2020

Note that I am absolutely not advocating that the new hello world template completely recreate everything that is currently in the older template. There are a lot of things in the older template that are YAGNI and not likely needed in most skills. Even having support for ALL locales is inconvenient for a getting-started skill, as it's much easier to get started with one locale and branch out to other locales as the skill matures. (I'd also argue that the util.js file in the new template is YAGNI...evidence being that it's not even used in the template...but I won't argue it too strongly.)

But, having the i18n module and attaching it to the handlerInput with a t() function so that you can externalize strings is a very useful option, even for a simple hello world skill. While you could argue that this is also a case of YAGNI, I argue that even if you only support one locale, the ability to externalize strings from the request handlers is valuable on its own and sets the groundwork for when a skill may evolve past a single locale.

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

Successfully merging this pull request may close these issues.

1 participant