diff --git a/.ask/config b/.ask/config
index d4d5a35..d708914 100644
--- a/.ask/config
+++ b/.ask/config
@@ -4,7 +4,7 @@
"skill_id": "",
"was_cloned": false,
"merge": {
- "skillManifest": {
+ "manifest": {
"apis": {
"custom": {
"endpoint": {
diff --git a/LICENSE.txt b/LICENSE.txt
deleted file mode 100644
index e7c4423..0000000
--- a/LICENSE.txt
+++ /dev/null
@@ -1,40 +0,0 @@
-Amazon Software License
-
-1. Definitions
-“Licensor” means any person or entity that distributes its Work.
-
-“Software” means the original work of authorship made available under this License.
-
-“Work” means the Software and any additions to or derivative works of the Software that are made available under this License.
-
-The terms “reproduce,” “reproduction,” “derivative works,” and “distribution” have the meaning as provided under U.S. copyright law; provided, however, that for the purposes of this License, derivative works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work.
-
-Works, including the Software, are “made available” under this License by including in or with the Work either (a) a copyright notice referencing the applicability of this License to the Work, or (b) a copy of this License.
-
-2. License Grants
-
-2.1 Copyright Grant. Subject to the terms and conditions of this License, each Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free, copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense and distribute its Work and any resulting derivative works in any form.
-
-2.2 Patent Grant. Subject to the terms and conditions of this License, each Licensor grants to you a perpetual, worldwide, non-exclusive, royalty-free patent license to make, have made, use, sell, offer for sale, import, and otherwise transfer its Work, in whole or in part. The foregoing license applies only to the patent claims licensable by Licensor that would be infringed by Licensor’s Work (or portion thereof) individually and excluding any combinations with any other materials or technology.
-
-3. Limitations
-
-3.1 Redistribution. You may reproduce or distribute the Work only if (a) you do so under this License, (b) you include a complete copy of this License with your distribution, and (c) you retain without modification any copyright, patent, trademark, or attribution notices that are present in the Work.
-
-3.2 Derivative Works. You may specify that additional or different terms apply to the use, reproduction, and distribution of your derivative works of the Work (“Your Terms”) only if (a) Your Terms provide that the use limitation in Section 3.3 applies to your derivative works, and (b) you identify the specific derivative works that are subject to Your Terms. Notwithstanding Your Terms, this License (including the redistribution requirements in Section 3.1) will continue to apply to the Work itself.
-
-3.3 Use Limitation. The Work and any derivative works thereof only may be used or intended for use with the web services, computing platforms or applications provided by Amazon.com, Inc. or its affiliates, including Amazon Web Services, Inc.
-
-3.4 Patent Claims. If you bring or threaten to bring a patent claim against any Licensor (including any claim, cross-claim or counterclaim in a lawsuit) to enforce any patents that you allege are infringed by any Work, then your rights under this License from such Licensor (including the grants in Sections 2.1 and 2.2) will terminate immediately.
-
-3.5 Trademarks. This License does not grant any rights to use any Licensor’s or its affiliates’ names, logos, or trademarks, except as necessary to reproduce the notices described in this License.
-
-3.6 Termination. If you violate any term of this License, then your rights under this License (including the grants in Sections 2.1 and 2.2) will terminate immediately.
-
-4. Disclaimer of Warranty.
-THE WORK IS PROVIDED “AS IS” WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WARRANTIES OR CONDITIONS OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE OR NON-INFRINGEMENT. YOU BEAR THE RISK OF UNDERTAKING ANY ACTIVITIES UNDER THIS LICENSE. SOME STATES’ CONSUMER LAWS DO NOT ALLOW EXCLUSION OF AN IMPLIED WARRANTY, SO THIS DISCLAIMER MAY NOT APPLY TO YOU.
-
-5. Limitation of Liability.
-EXCEPT AS PROHIBITED BY APPLICABLE LAW, IN NO EVENT AND UNDER NO LEGAL THEORY, WHETHER IN TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE SHALL ANY LICENSOR BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF OR RELATED TO THIS LICENSE, THE USE OR INABILITY TO USE THE WORK (INCLUDING BUT NOT LIMITED TO LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, COMPUTER FAILURE OR MALFUNCTION, OR ANY OTHER COMM ERCIAL DAMAGES OR LOSSES), EVEN IF THE LICENSOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-Effective Date – April 18, 2008 © 2008 Amazon.com, Inc. or its affiliates. All rights reserved.
\ No newline at end of file
diff --git a/Readme.md b/Readme.md
old mode 100644
new mode 100755
index bc68e93..fdf6886
--- a/Readme.md
+++ b/Readme.md
@@ -1,24 +1,26 @@
-# Build An Alexa Trivia Skill
-
+# Alexa トリビアスキルの作成 🇯🇵
+
-[](./instructions/1-voice-user-interface.md)[](./instructions/2-lambda-function.md)[](./instructions/3-connect-vui-to-code.md)[](./instructions/4-testing.md)[](./instructions/5-customization.md)[](./instructions/6-publication.md)
+この Alexa サンプルスキルは、「トナカイトリビア」と呼ばれるトリビアスキルのテンプレートを使って、対話型のスキル開発を説明します。スキルは起動時にランダムに質問を1つ抽出し、それをユーザーに尋ねます。
-The template leverages [AWS Lambda](https://aws.amazon.com/lambda/), the [Alexa Skills Kit (ASK)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit), and the [ASK SDK](https://developer.amazon.com/public/community/post/Tx213D2XQIYH864/Announcing-the-Alexa-Skills-Kit-for-Node-js), while providing the business logic, multiple language support, use cases, error handling and help functions for your skill. You just need to come up with a content idea (like "Santa Claus Trivia"), plug in your content and edit the sample provided (we walk you through how it’s done). It's a valuable way to quickly learn the end-to-end process for building and publishing an Alexa skill.
+**開始** するには次のボタンをクリックしてください。
-This tutorial will walk first-time Alexa skills developers through all the required steps involved in creating a skill using this trivia skill template, called ‘Reindeer Trivia’. This post assumes you have some familiarity with JavaScript/Node.js (or a similar programming language) and the Alexa Skills Kit.
+[](instructions/1-voice-user-interface.md)
-Using the Alexa Skills Kit, you can build an application that can receive and respond to voice requests made on the Alexa platform. In this tutorial, you’ll build a web service to handle notifications from Alexa and map this service to a skill in the Amazon Developer Portal, making it available on your device and to all Alexa users after certification.
+もしくは、コマンドラインを使った ASK CLI (command line interface) を利用するには [こちら](./instructions/7-cli.md) をクリックしてください。
- After completing this tutorial, you will know how to:
+## 追加情報
- * **Create a parameter-based skill** - This tutorial will walk first-time Alexa skills developers through all the required steps involved in creating a parameter-based skill using a template called ‘Reindeer Trivia’.
- * **Understand the basics of VUI design** - Creating this skill will help you understand the basics of creating a working Voice User Interface (VUI) while using a cut/paste approach to development. You will learn by doing, and end up with a published Alexa skill. This tutorial includes instructions on how to customize the skill and submit it for certification. For guidance on designing a voice experience with Alexa you can also [watch this video](https://goto.webcasts.com/starthere.jsp?ei=1087592).
- * **Use JavaScript/Node.js and the Alexa Skills Kit to create a skill** - You will use the template as a guide but the customization is up to you. For more background information on using the Alexa Skills Kit please [watch this video](https://goto.webcasts.com/starthere.jsp?ei=1087595).
- * **Get your skill published** - Once you have completed your skill, this tutorial will guide you through testing your skill and sending your skill through the certification process, making it available to be enabled by any Alexa user.
+### Blogs
+* [Alexa Blogs(日本))](https://developer.amazon.com/ja/blogs/alexa/tag/Japan)
+* [Alexa Blogs(米国))](https://developer.amazon.com/ja/blogs/alexa)
-# Let's Get Started
+### コミュニティ
+* [Amazon Developer Forums](https://forums.developer.amazon.com/spaces/293/index.html) - 会話に参加してみましょう!
+* [Hackster.io](https://www.hackster.io/amazon-alexa) - 他の人がどんなスキルを作成しているか参考になります。
-
+### チュートリアルとガイドライン
+* [音声デザインガイド](https://developer.amazon.com/ja/designing-for-voice/) - 対話と音声インターフェイスに関して学べます。
-
-
+### ドキュメント
+* [Alexa Skills Kitオフィシャルドキュメント](https://developer.amazon.com/docs/ask-overviews/build-skills-with-the-alexa-skills-kit.html)
\ No newline at end of file
diff --git a/instructions/1-voice-user-interface.md b/instructions/1-voice-user-interface.md
old mode 100644
new mode 100755
index 99e0c0d..750e6f8
--- a/instructions/1-voice-user-interface.md
+++ b/instructions/1-voice-user-interface.md
@@ -1,137 +1,30 @@
-# Build An Alexa Trivia Skill
-[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
+# Alexa トリビアスキルの開発
+
-## Setting up Your Alexa Skill in the Developer Portal
+[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
-There are two parts to an Alexa skill. The first part is the [Voice User Interface (VUI)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/defining-the-voice-interface). This is where we define how we will handle a user's voice input, and which code should be executed when specific commands are uttered. The second part is the actual code logic for our skill, and we will handle that on [page #2](./2-lambda-function.md) of this instructions guide.
+1. まず [Amazon開発者ポータル](https://developer.amazon.com/ja/alexa) を開き、右上にある **サインイン** ボタンをクリックします。もし、まだアカウントを持っていない場合でも、無料で新規アカウントを作成することができます。
-1. **Go to the [Amazon Developer Portal](http://developer.amazon.com). In the top-right corner of the screen, click the "Sign In" button.** (If you don't already have an account, you will be able to create a new one for free.)
+2. サインイン後、画面上部にある **あなたのAlexaコンソール** にマウスカーソルをあてて、**Skills**をクリックします。
-
+3. **alxea developer console** のページが開いたら、**スキルの作成** ボタンをクリックします。
-2. **Once you have signed in, click the Alexa button at the top of the screen.**
+4. **スキル名** を入力します。これはAlexaスキルストアでユーザーに表示される名前です。またデフォルトの言語を **日本語(日本)** に設定してください。
-
+5. **カスタム** モデルを選択して、画面右上の**スキルを作成** ボタンを押してください。
-3. **On the Alexa page, choose the "Get Started" button for the Alexa Skills Kit.**
+6. **対話モデルの構築**
+ 1. 画面左側のナビゲーションパネルの **対話モデル** から **JSONエディター** を選択してください。右側JSONエディターの内容を、[models/ja-JP.json](../models/ja-JP.json) の中のもので置き換えてください。(選択したスキルの言語と同じモデルであることをご確認ください) 置き換えたら **モデルを保存** をクリックします
+ 2. **対話モデル** から **呼び出し名** を選択してください。ここで指定する呼び出し名をユーザーが発話すると、スキルが起動します。ここでは "トナカイトリビア" にします。完了したら **モデルを保存** をクリックします。
+ 3. **モデルをビルド** ボタンをクリックします。 **正常にビルドされました** というメッセージがでるまで、しばらくお待ちください。
+
+7. **オプショナル** 画面左側のナビゲーションパネルの **対話モデル** にある **インテント** と **スロットタイプ** は、先のJSONエディターによる対話モデルの入力により自動的に構築されます。よろしければそれぞれ確認して、ユーザーが発話しそうなパターンを考慮して対話モデルを膨らませてみてください。これらを変更した場合は、**モデルを保存** と **モデルをビルド** を都度行うことをお忘れなく。**インテント** と **スロットタイプ** に関しては[技術資料](https://developer.amazon.com/docs/custom-skills/create-intents-utterances-and-slots.html?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=trivia-nodejs-V2_GUI-1&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_trivia-nodejs-V2_GUI-1_Convert_WW_beginnersdevs&sc_segment=beginnersdevs)を参照してください。
+
+8. 対話モデルのビルドが成功した場合、次のステップに進んでください。ビルドがうまくいかなかった場合、エラーが表示されますので解決を試みてください。このガイドの次のステップでは、AWS 開発者コンソールから Lambda 関数を作成します。このブラウザのタブは開いたままにしておいてください。[3ページ: VUIとコードを繋げる](3-connect-vui-to-code.md)で再びこの画面に戻ってきます。
+
+ もし、対話モデルでエラーが発生するようであれば、下記を確認してください。
-
+ * **コードを正しく適切なボックスにコピー&ペーストしましたか?**
+ * **対話モデルもしくはサンプル発話に誤った文字を入力していませんか?**
-4. **Select "Add A New Skill."** This will get you to the first page of your new Alexa skill.
-
-
-
-5. **Fill out the Skill Information screen.** Make sure to review the tips we provide below the screenshot.
-
-
-
- ### Skill Information Tips
- 1. **Skill Type** For this skill, we are creating a skill using the Custom Interaction Model. This is the default choice.
-
- 2. **Language** Choose the first language you want to support. You can add additional languages in the future, but we need to start with one. (This guide is using U.S. English to start.)
-
- 3. **Name** This is the name that will be shown in the Alexa Skills Store, and the name your users will refer to.
-
- 4. **Invocation Name** This is the name that your users will need to say to start your skill. We have provided some common issues developers encounter in the list below, but you should also review the entire [Invocation Name Requirements](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/choosing-the-invocation-name-for-an-alexa-skill).
-
- | Invocation Name Requirements | Examples of incorrect invocation names |
- | ---------------------------- | -------------------------------------- |
- | The skill invocation name must not infringe upon the intellectual property rights of an entity or person. | korean air; septa check |
- | Invocation names should be more than one word (unless it is a brand or intellectual property), and must not be a name or place | horoscope; trivia; guide; new york |
- | Two word invocation names are not allowed when one of the words is a definite article, indefinite article, or a preposition | any poet; the bookie; the fool |
- | The invocation name must not contain any of the Alexa skill launch phrases and connecting words. Launch phrase examples include "launch," "ask," "tell," "load," and "begin." Connecting word examples include "to," "from," "by," "if," "and," "whether." | trivia game for star wars; better with bacon |
- | The invocation name must not contain the wake words "Alexa," "Amazon," "Echo," or the words "skill" or "app." | hackster initial skill; word skills |
- | The invocation name must be written in each language you choose to support. For example, the German version of your skill must have an invocation name written in German, while the English (US) version must have an invocation name written in English. | kitchen stories (German skill) |
-
- 5. **Audio Player** For this Trivia Skill, we won't be using any audio files, so you can select No for this option. If you would like to learn more about adding audio to your skills, please check out our [Audio Player Guide](https://github.com/alexa/skill-sample-nodejs-audio-player).
-
-6. **Click the Next button to move to the Interaction Model.**
-
-
-
-7. Click on the **Launch Skill Builder** (Beta) button . This will launch the new Skill Builder Dashboard.
-
- 
-
-8. Click on the "Code Editor" item under **Dashboard** on the top left side of the skill builder.
-
-
-9. In the textfield provided, replace any existing code with the code provided in the [Interaction Model](../InteractionModel.json), then click "Apply Changes" or "Save Model".
-
-
-8. Click on the "Add+" button near **Intents** on the top left corner of the dashboard.
-
- 
-
-9. In the textbox provided, enter the new intent name: **GetAnswerIntent.**, and click the **Create Intent** button.
-
- 
-
-10. Add 10-15 sample utterances for your intent. These are the things a user would say to make this intent happen. Here are a few examples:
-
- * {Answer} is my answer
- * {Answer}
- * is it {Answer}
- * my answer is {Answer}
-
- 
-
-11. Click on the **Save Model** button, and then click on the **Build Model** button.
-
- 
-
-
-
-12. If your interaction model builds successfully, click on **Configuration button** to move on to Configuration. In our next step of this guide, we will be creating our Lambda function in the AWS developer console, but keep this browser tab open, because we will be returning here on [Page #3: Connect VUI to Code](./3-connect-vui-to-code.md).
- 
-
- If you get an error from your interaction model, check through this list:
-
- * **Did you copy & paste the provided code into the appropriate boxes?**
- * **Did you accidentally add any characters to the Interaction Model or Sample Utterances?**
-
-
-
-
-
+[](./2-lambda-function.md)
\ No newline at end of file
diff --git a/instructions/2-lambda-function.md b/instructions/2-lambda-function.md
old mode 100644
new mode 100755
index 0397686..cfecef8
--- a/instructions/2-lambda-function.md
+++ b/instructions/2-lambda-function.md
@@ -1,60 +1,46 @@
-# Build An Alexa Trivia Skill
-[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
+# Alexa トリビアスキルの開発
+
+[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
+## Amazon Web Services を使い Lambda 関数を作成する
-
+このガイドの[最初のステップ](./1-voice-user-interface.md)で、Alexa スキル用の音声ユーザーインターフェース (VUI) を作成しました。このページでは、[Amazon Web Services](http://aws.amazon.com/jp) を使って Lambda 関数を作っていきます。詳細は [AWS Lambda](http://aws.amazon.com/jp/lambda) に記載されていますが、今回のスキルを作る上で知っておくべきことは、私たちのコードは AWS Lambda で実行されるということだけです。ユーザーが Alexa でスキルを呼び出したとき、適切な応答を返して会話を成立させるのが Lambda 関数です。
-## Setting Up A Lambda Function Using Amazon Web Services
+1. **http://aws.amazon.com/jp** にサインインしてコンソールを開きます。まだアカウントを持っていない場合は、アカウントを作成する必要があります。[新規AWSアカウントの作成手順](../set-up-aws.md)を参考にしてください。
-In the [first step of this guide](../instructions/1-voice-user-interface.md), we built the Voice User Interface (VUI) for our Alexa skill. On this page, we will be creating an AWS Lambda function using [Amazon Web Services](http://aws.amazon.com). You can [read more about what a Lambda function is](http://aws.amazon.com/lambda), but for the purposes of this guide, what you need to know is that AWS Lambda is where our code lives. When a user asks Alexa to use our skill, it is our AWS Lambda function that interprets the appropriate interaction, and provides the conversation back to the user.
+ [](https://console.aws.amazon.com/console/home)
-1. **Go to http://aws.amazon.com and sign in to the console.** If you don't already have an account, you will need to create one. [If you don't have an AWS account, check out this quick walkthrough for setting it up](https://github.com/alexa/alexa-cookbook/tree/master/aws/set-up-aws.md).
+2. 画面の上にあるメニューバーから **AWS サービス** を選び、検索窓に **Lambda** と入力します。サービス一覧からも選択することができます。Lambda は「コンピューティング」のセクションにあります。
-
+ [](https://console.aws.amazon.com/lambda/home)
-2. **Click "Services" at the top of the screen, and type "Lambda" in the search box.** You can also find Lambda in the list of services. It is in the "Compute" section.
+3. **AWS リージョン** を確認します。Alexa Skills Kit が利用できる Lambda のリージョンは2017年11月時点では、アジアパシフィック (東京)、米国東部 (バージニア北部)、米国西部 (オレゴン)、EU (アイルランド)の4つです。スキルのユーザーに最も近いリージョンを選択します。
-
+ 
-3. **Check your AWS region.** AWS Lambda only works with the Alexa Skills Kit in two regions: US East (N. Virginia) and EU (Ireland). Make sure you choose the region closest to your customers.
+4. **関数の作成** ボタンをクリックします。画面の右上にあります。
-
+ 
-4. **Click the "Create a Lambda function" button.** It should be near the top of your screen. (If you don't see this button, it is because you haven't created a Lambda function before. Click the blue "Get Started" button near the center of your screen.)
+5. 関数の作成ページは "一から作成"、"設計図"、"サーバーレスアプリケーションのレポジトリ"という3つのボックスがありますので、**サーバーレスアプリケーションのレポジトリ** を選択してください。簡便化のため、スキルを作成する上で必要となる全ての設定を行うアプリケーションを用意しています。Lambda 関数用の Alexa-sdk もあらかじめ用意されているので、自分でアップロードする必要はありません。
-
+6. **検索フィールドに `alexa-skills-kit-nodejs-triviaskill` と入力してアプリケーションを検索してください。**
-5. **Choose the blueprint named "alexa-skill-kit-sdk-factskill".** We have created a blueprint as a shortcut to getting everything set up for your skill. You can search for a blueprint using the provided search box. This blueprint adds the alexa-sdk to your Lambda function so that you don't have to upload it yourself.
+7. **検索したアプリケーションをクリックしてください** このアプリケーションはLambda関数を作成し、Alexaスキルキットから呼び出しされる権限と、IAMロールの設定を行います。加えてGitHubから関連する一連のコードを取得し追加します。
-
+8. 必要でしたら Application name を変更して、**Deploy** ボタンをクリックしてください。
-6. **Configure your function.** This screen is where we will enter the important parts of our Lambda function. These values will only ever be visible to you, but make sure that you name your function something meaningful. "TriviaSkill" is sufficient if you don't have another idea for a name.
+9. 画面右下に現れる3つの Resource の Status がすべて **CREATE_COMPLETE** になるまで待ちます。このとき、画面中央にも **Application successfully deployed** と表示されるはずです。
-
+10. Lamda コンソールで作成された Lamda関数を開きます。通常、Resource 一覧の一番上に表示されているものをクリックしてください。
-7. **Set up your Lambda function role.** If you haven't done this before, we have a [detailed walkthrough for setting up your first role for Lambda](https://github.com/alexa/alexa-cookbook/tree/master/aws/lambda-role.md). If you have done this before, set your **Existing role** value to "lambda_basic_execution."
+11. Lamda関数のページに移行したら、ページをスクロールダウンして、**関数コード** を参照してください。
-
+12. index.js の内容を [lambda/custom/index.js](../lambda/custom/index.js) と [lambda/custom/questions.js](../lambda/custom/questions.js) のコードで置き換えてください。それぞれ画面右上の **保存** ボタンをクリックします。
-8. **Create the Lambda Function.** You will need to scroll down to find **Create Function** Click it to create your function.
+13. このページの先頭のほうに、このLambda関数の Amazon Resource Name (ARN)が表示されています。(表示されていなければスクロールアップしてみてください) この値は次のステップで利用しますので、**arn: で始まる値をコピーしておいてください**
-
+ 
-
-9. **Configure your trigger.** Click the **Triggers** tab. Within the **Triggers** pane, click the link to **Add a Trigger**. A pop-up should appear, click in the dashed box and select Alexa Skills Kit from the list. If you don't see Alexa Skills Kit in the list, jump back to step #3 on this page.
-
-
-
- Once you have selected Alexa Skills Kit, click the **Configuration** Tab to go back to your code.
-
-10. **Copy and paste the [provided code](https://github.com/alexa/skill-sample-nodejs-trivia/blob/master/lambda/custom/index.js) into the Lambda function code box.** We have provided the code for this skill on [GitHub](../src/index.js). Delete the contents of the code box, and paste the contents of the new code.
-
-11. **The ARN value should be in the top right corner. Copy this value for use in the next section of the guide.**
-
-
-
-
-
-
-
+[](./3-connect-vui-to-code.md)
diff --git a/instructions/3-connect-vui-to-code.md b/instructions/3-connect-vui-to-code.md
old mode 100644
new mode 100755
index 88eab32..ef526a7
--- a/instructions/3-connect-vui-to-code.md
+++ b/instructions/3-connect-vui-to-code.md
@@ -1,33 +1,23 @@
-# Build An Alexa Trivia Skill
-[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
+# Alexa トリビアスキルの開発
+
-## Connecting Your Voice User Interface To Your Lambda Function
+[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
-On [page #1](./1-voice-user-interface.md) of this guide, we created a voice user interface for the intents and utterances we expect from our users. On [page #2](./2-lambda-function.md), we created a Lambda function that contains all of our logic for the skill. On this page, we need to connect those two pieces together.
+## 音声ユーザーインターフェース (VUI) とコードをつなげる
-1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial.
+このガイドの[1ページ目](./1-voice-user-interface.md)で、エンドユーザーから期待するインテントとサンプル発話の設定を行い音声ユーザーインターフェースを作成しました。[2ページ目](./2-lambda-function.md)では、Lambda 関数を作成しこのスキルに必要な全てのロジックを実装しました。このページでこれら2つの部分をつなげます。
-2. **Open the "Configuration" tab on the left side.**
+1. [Amazon開発者ポータル](https://developer.amazon.com/edw/home.html#/skills/list)に戻り、一覧からあなたのスキルを選択します。
-
+2. **ビルド** タブを選択し、左側のナビゲーションパネルにある **エンドポイント** を選択します。
-3. **Select the "AWS Lambda ARN" option for your endpoint.** You have the ability to host your code anywhere that you would like, but for the purposes of simplicity and frugality, we are using AWS Lambda. ([Read more about Hosting Your Own Custom Skill Web Service](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service).) With the AWS Free Tier, you get 1,000,000 free requests per month, up to 3.2 million seconds of compute time per month. Learn more at https://aws.amazon.com/free/. In addition, Amazon now offers [AWS Promotional Credits for developers who have live Alexa skills that incur costs on AWS related to those skills](https://developer.amazon.com/alexa-skills-kit/alexa-aws-credits).
+3. サービスのエンドポイントの種類として **AWS LambdaのARN** を選択します。コードは好きな場所に設置することも可能ですが、単純化とコスト削減のため、ここでは AWS Lambda を利用します。ウェブサービスとしてカスタムスキルをホスティングする方法については[こちら](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-an-alexa-skill-as-a-web-service)を参照してください。AWS の無料利用枠を利用することで、毎月100万回の Lambda 関数の起動、320万秒のコンピューティング時間が無料で使えます。無料利用枠については[こちら](https://aws.amazon.com/jp/free/)を参照してください。 さらにアマゾンではただいま、Alexaスキルの開発者向けに [Alexa AWSプロモーションクレジット](https://developer.amazon.com/ja/alexa-skills-kit/alexa-aws-credits?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=trivia-nodejs-V2_GUI-3&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_trivia-nodejs-V2_GUI-3_Convert_WW_beginnersdevs&sc_segment=beginnersdevs) をご紹介しています。是非ご活用ください。
-
-4. **Select "North America" or "Europe" as your geographical region.** IMPORTANT: Make sure you select the same region that you created your Lambda in. Remember, Alexa skills using AWS Lambda can only run in N. Virginia (North America) and Ireland (Europe).
+4. 前のセクションの最後のステップでコピーした Lambda関数 の **ARN (Amazon Reource Name)** を **デフォルトの地域** のテキストボックスに貼り付けます。
-
+5. 画面上部にある **エンドポイントを保存** をクリックしてください。
-5. **Paste your Lambda's ARN (Amazon Resource Name) into the textbox provided.** It should look similar to the screenshot above.
+6. このステップは以上で完了です。次のステップに進みましょう。
-6. **Leave "Account Linking" set to "No."** For this skill, we won't be using Account Linking, but you can learn more about [Linking an Alexa User with a User in Your System.](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/linking-an-alexa-user-with-a-user-in-your-system)
-
-7. **Click the "Next" button to continue to page #4 of this guide.**
-
- [](./4-testing.md)
-
-
-
-
-
+[](./4-testing.md)
diff --git a/instructions/4-testing.md b/instructions/4-testing.md
old mode 100644
new mode 100755
index dde15e6..06b99c6
--- a/instructions/4-testing.md
+++ b/instructions/4-testing.md
@@ -1,90 +1,57 @@
-# Build An Alexa Trivia Skill
-[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
+# Alexa トリビアスキルの開発
+
-## Testing Your Alexa Skill
+[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
-So far, we have [created a Voice User Interface](./1-voice-user-interface.md) and [a Lambda function](./2-lambda-function.md), and [connected the two together](./3-connect-vui-to-lambda.md). Your skill is now ready to test.
+## Alexa スキルのテスト
-1. **Go back to the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list) and select your skill from the list.** You may still have a browser tab open if you started at the beginning of this tutorial.
+ここまでで、[音声ユーザーインターフェース](./1-voice-user-interface.md)と [Lambda 関数](./2-lambda-function.md)を作成し、[それらを連携](./3-connect-vui-to-code.md)させました。 これであなたのスキルをテストする準備が整いました。
-2. **Open the "Test" tab on the left side.**
+1. [Amazon開発者ポータル](https://developer.amazon.com/alexa/console/ask?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=trivia-nodejs-V2_GUI-4&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_trivia-nodejs-V2_GUI-4_Convert_WW_beginnersdevs&sc_segment=beginnersdevs)に戻り、あなたが作ったスキルを選択します。
-
+2. トップナビゲーションメニューから **テスト** タブを選択し **Alexaシミュレータ**を表示します。ブラウザによってはマイクへのアクセス許可を要求する場合があります。マイクを有効にすることを推奨しますが、テキスト入力によるテストも可能です。
-3. **Understand the voice simulator.** While it's not specific to your skill, the Voice Simulator is a valuable testing tool for every skill. Type a word into the box, and click the "Listen" button to hear how Alexa will
-pronounce it. To make changes to her pronunciation, use Speech Synthesis Markup Language [(SSML)](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/speech-synthesis-markup-language-ssml-reference) to modify how Alexa will interpret text to speech. Try these examples:
+3. **このスキルでは、テストは無効になっています** というメッセージが上部に表示されていますので、その横のトグルスイッチを切り替えて **このスキルでは、テストは有効になっています** という状態にしてください。
- ```html
- 12345
- ```
+4. **Alexaシミュレータ** で、あなたのスキルが期待どおりに動作するか検証します。テキストボックスに文字を入力するか、マイクアイコンを押した状態でマイクに話しかけてみてください。
+ 1. **文字入力** [Step 1](./1-voice-user-interface.md)で指定したスキルの **呼び出し名** に続き "を開いて" とタイプしてください。(例:"トナカイトレビアを開く")
+ 2. **音声** テキストボックス横のマイクアイコンを押下した状態で、スキルの **呼び出し名** に続き "を開いて" と発話してください。
+ 3. スキルの **呼び出し名** を忘れた場合、トップナビゲーションメニューから **ビルド** タブを選択して、左側パネルの **呼び出し名** で確認してください。
- ```html
- 12345
- ```
+5. あなたのスキルが期待する動作をするか確認してください。
+ * Alexaシミュレータで検証をしたら、スキルI/O パネルの **JSON入力** と **JSON出力** ボックスを参照ください。また上部にある **デバイスのログ** を有効にすると、動作ステップも参照できます。
+ * もし期待する動作をしない場合は、上記のスキルI/Oパネルが実際にLambda関数とやり取りしている入出力となりますので、問題解析のヒントにしてください。もちろん AWS Lambda も問題解決のための追加ツールを用意しています。
- ```html
- 12345
- ```
+6. **AWS Lambda のテストイベント設定** サービスシミュレーターの **リクエスト(JSON入力)** と **レスポンス(JSON出力)** について説明しました。この **リクエスト** の値を利用することで、Lambda 関数をアップデートした場合も直接テストすることができます。 次のような手順で行います。
+ 1. **Alexaシミュレーター** でテキストか音声で発話をして、発生したリクエスト(JSON入力)の内容を次のステップのためにコピーしておいてください。
-
+ 2. **AWS マネジメントコンソール** に移動して Lambda 関数を開き、**アクション** メニューの右側のドロップダウンリストから **テストイベントの設定** を選択します。
- Return to the Voice Simulator as needed to ensure that Alexa says words and phrases as you would expect.
+ 3. **新しいテストイベントの作成** を選択して、イベントテンプレートのドロップダウンリストから **Alexa Start Session** を選択します。 実際はどのイベントテンプレートを選んでも良いのですが、覚えやすいのでここでは **Alexa Start Session** を利用します。 
-4. **Test your skill with the Service Simulator.** To validate that your skill is working as expected, use the Service Simulator. In the **Enter Utterance** text box, type "open reindeer trivia"
+ 4. **イベント名** フィールドにイベント名を入力します。コードエディターの内容を削除して、先にコピーしたLambdaリクエスト(JSON入力)をペーストします。テキストボックスの内容を削除し、サービスシミュレーターから取得したリクエストの内容を貼り付けます。イベント名は、テストの内容を連想しやすければ、特に何でもかまいません。例えば、"startSession"でも結構です。AlexaシミュレータからLambdaリクエストをコピー・ペーストすることで、さまざまな発話にたいするテストイベントを作成することができます。
-
+ 5. **作成** ボタンをクリックします。これによりテストイベントが保存され、Lambda関数のメインページで **テスト** ボタンの左に指定したテストイベント名が現れます。
- ### Service Simulator Tips
- * After you click the "Ask [Your Skill Name]" button, you should see the **Lambda Request** and **Lambda Response** boxes get populated with JSON data like in the screenshot above.
- * Click the **Listen** button in the bottom right corner to hear Alexa read the response.
+ 6. 作成したテストイベント(例 startSession)を選択して **「テスト」** ボタンをクリックします。これにより Lambda 関数に対して設定したテストの内容が実行されます。
+
+ テストにより4つのことが確認できます。
- * If you receive a response that reads: *"The remote endpoint could not be called, or the response it returned was invalid,"* this is an indication that something is broken. AWS Lambda offers an additional testing tool to help you troubleshoot your skill.
+ * **レスポンス(JSON出力)** 「実行結果」内に表示されます。
+ 
-5. **Configure a test event in AWS Lambda.** Now that you are familiar with the **request** and **response** boxes in the Service Simulator, it's important for you to know that you can use your **requests** to directly test your Lambda function every time you update it. To do this:
- 1. Enter an utterance in the service simulator, and copy the generated Lambda Request for the next step.
+ * **実行結果の統計値の概要** ここには所用時間や課金時間、設定済みリソース、使用メモリなどが表示されます。
- 2. **Open your Lambda function in AWS, open the Actions menu, and select "Configure test events."**
+ * **ログ出力** Lambda 関数のコード内で console.log() を適切に使うことで、 関数内で何が起こっているかトラッキングすることができます。何か問題が起きた時に原因を特定する場合に役に立つでしょう。より高度なスキルを作るようになった時、ログの有用性に気づくはずです。
+ 
-
+ * ログ出力の説明の "[ここをクリックし](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:)" からリンクされる [CloudWatch](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:)には、このLambda関数の **全て** のレスポンスとエンドユーザーとのやりとりが記録されます。これはとても有益で、特に自分のデバイスでスキルをテストする時に非常に役に立ちます。
- 3. **Select "Create New Test Event". Choose "Alexa Start Session" as the Event Template from the dropdown list.** You can choose any test event in the list, as they are just templated event requests, but using "Alexa Start Session" is an easy one to remember.
+7. **その他のテスト方法:**
-
+ * [Echosim.io](https://echosim.io) はブラウザベースのAlexaスキルのテストツールです。実機デバイスがなくてもテストできるので便利です。
+ * [Unit Testing with Alexa](https://github.com/alexa/alexa-cookbook/tree/master/testing/postman/README.md) は [Postman](http://getpostman.com) と [Amazon API Gateway](http://aws.amazon.com/apigateway)を使用したモダンなユニットテストのアプローチです。
- 4. **Type in an Event Name into the Event Name Dialog box. Delete the contents of the code editor, and paste the Lambda request you copied above into the code editor.** The Event Name is only visible to you. Name your test event something descriptive and memorable. For our example, we entered an event name as "startSession". Additionally, by copying and pasting your Lambda Request from the service simulator, you can test different utterances and skill events beyond the pre-populated templates in Lambda.
+8. サンプルスキルが正常に動作することを確認できたら、このスキルを**カスタマイズ**しましょう。
-
-
- 5. **Click the "Create" button.** This will save your test event and bring you back to the main configuration for your lambda function.
-
- 6. **Click the "Test" button to execute the "startSession" test event.**
-
-
-
- This gives you visibility into four things:
-
- * **Your response, listed in the "Execution Result."**
-
-
-
- * **A Summary of the statistics for your request.** This includes things like duration, resources, and memory used.
-
-
-
- * **Log output.** By effectively using console.log() statements in your Lambda code, you can track what is happening inside your function, and help to figure out what is happening when something goes wrong. You will find the log to be incredibly valuable as you move into more advanced skills.
-
-
-
- * **A link to your [CloudWatch](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:) logs for this function.** This will show you **all** of the responses and log statements from every user interaction. This is very useful, especially when you are testing your skill from a device with your voice. (It is the "[Click here](https://console.aws.amazon.com/cloudwatch/home?region=us-east-1#logs:)" link in the Log Output description.)
-
-6. **Other testing methods to consider:**
-
- * [Echosim.io](https://echosim.io) - a browser-based Alexa skill testing tool that makes it easy to test your skills without carrying a physical device everywhere you go.
- * [Unit Testing with Alexa](https://github.com/alexa/alexa-cookbook/tree/master/testing/postman/README.md) - a modern approach to unit testing your Alexa skills with [Postman](http://getpostman.com) and [Amazon API Gateway](http://aws.amazon.com/apigateway).
-
-7. **If your sample skill is working properly, you can now customize your skill.**
-
-
-
-
-
+[](./5-customization.md)
\ No newline at end of file
diff --git a/instructions/5-customization.md b/instructions/5-customization.md
old mode 100644
new mode 100755
index b99c77b..64355a9
--- a/instructions/5-customization.md
+++ b/instructions/5-customization.md
@@ -1,38 +1,36 @@
-# Build An Alexa Trivia Skill
-[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
+# Alexa トリビアスキルの開発
+
-## Add Additional Languages (Optional)
+[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
-You can use the Alexa Skills Kit to create skills in multiple languages. A skill can support a single language, or any combination of the available languages:
-* English (US)
-* English (UK)
-* German
+## スキルのカスタマイズ
-For more on developing skills in multiple languges, go [here](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/developing-skills-in-multiple-languages).
+ここまででトリビアスキルの作業用コピーが用意できました。これをあなたのオリジナルのスキルにするために、事前に用意しておいたデータと応答文を使ってカスタマイズしましょう。変更すべき点は以下の通りです。
-1. To add an additional language, simply select the Add New Language tab in Developer Portal and choose your second language. Choose and fill all necessary information like we did for the initial language of your skill. You will need to define Name and Invocation Name for the current language (e.g. German name for German skills). Then click Save to continue.
-
+1. **新しいデータ** あなたが選んだトピックに関するトリビアを用意してください。最低でも25個、できれば100個近くのトリビアがあればユーザーによりよい体験を提供できるでしょう。
-2. In the Interaction Model section, our skill shares the same intent schema and uses different sample utterances and custom slot type values in different languages. Copy the corresponding .json model from the [GitHub repository here](https://github.com/alexa/skill-sample-nodejs-trivia/blob/master/models) into the "code" section in the Skill Builder to change sample utterances into your second language. We will not be using custom slots in this template, but slot type values should be put in the new language if your skill has them. For Reindeer Trivia in German, go [GitHub repository here](https://github.com/alexa/skill-sample-nodejs-trivia/tree/master/models/de-DE.json) for a sample model.
-
+ 1. **index.js** を開きます。まだコードをダウンロードしていない場合は、ここから[ダウンロード](../lambda/custom/index.js)できます。[Atom](http://atom.io)や[Sublime Text](http://sublimetext.com)、[VSCode](http://code.visualstudio.com)といったシンプルで軽量なエディタで修正することもできますが、ブラウザに表示された Lambda関数を直接編集することもできます。
-3. Open the source file for your Lambda function, index.js. In the languageString variable, look up the locale for your current language, edit the language strings, and other message like you did for your initial language. Also remember to edit questions in questions.js. Questions and answers are supposed to be defined using your second language.
-
-
+ 2. コードの中から **TODO: ここから下のデータを自分用にカスタマイズしてください。** というコメント文を探します。 これがスキルのデータ部分です。シンプルなリストであることがわかるでしょう。
-4. For better latency, deploying your code to different endpoints is recommended. Follow the Create Lambda Function instructions in Step 2 and be sure to select an appropriate Lambda region. Select **US East (N. Virginia)** for US skills and **EU (Ireland)** for UK/DE skills. Copy the ARN for use in the Configuration section of the Amazon Developer Portal.
+ 3. index.js の内容を変更したら、**AWS マネジメントコンソール** に移動して Lambda 関数を開き、関数コードのところで index.js のデータを入れ替えます。テキストをコピー&ペーストするだけなのでとても簡単です。
-5. Go back to skill Configuration section, which contains Global fields for all languages. Add an extra endpoint and paste your Lambda ARN. Save your skill configuration information.
+ 
-
+2. **ユーザーへの応答文**
-6. Test your skill in the second language using Service Simulator or a device.
+ 応答文はあなたのスキル用にカスタマイズした方が良いでしょう。
-4. **Once you have made the updates listed on this page, you can click "Next" to move on to Publishing and Certification of your skill.**
+ 1. **[index.js](../lambda/custom/index.js)** のコピーに戻ります。
-
+ 2. **TODO: このコメント行より下の項目に注目してください。** というコメント行を探してください。その下にスタマイズすべき部分がみつかります。
-
-
+ 3. **index.js** をファイルの下の方まで読むと、どの部分を変更すべきかおよそ察しがつくでしょう。
-
+3. **新しい言語** もし、日本語以外の言語にスキルを提供したい場合は、Alexaの応答がそれらの言語でなされるようにしてください。
+
+ * 例えば、ドイツ向きスキルを作る場合、全てのAlexaからの応答はドイツ語でなされる必要があります。もしドイツ向きのスキルの応答が日本語でなされるようなことがある場合、審査を通過することはできないでしょう。
+
+4. このページに記載した全てのアップデートが終わったら、下のボタンをクリックして、**スキルの公開**に進んでください
+
+[](./6-publication.md)
\ No newline at end of file
diff --git a/instructions/6-publication.md b/instructions/6-publication.md
old mode 100644
new mode 100755
index d388e1b..9c3c1a7
--- a/instructions/6-publication.md
+++ b/instructions/6-publication.md
@@ -1,128 +1,103 @@
-# Build An Alexa Trivia Skill
-[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
+# Alexa トリビアスキルの開発
+
-## Get Your Skill Certified and Published
+[](./1-voice-user-interface.md)[](./2-lambda-function.md)[](./3-connect-vui-to-code.md)[](./4-testing.md)[](./5-customization.md)[](./6-publication.md)
-We are almost done! The last step is to add the metadata that your skill will use in the [Alexa app](http://amazon.com/skills). This page will walk you through the remaining steps, and give you some tips on how to avoid the common mistakes developers make that result in a failed certification.
+## スキルの認定と公開
-1. **Go to your skill's Publishing Information tab on the [Amazon Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list).**
+スキルの公開までもう少しです。最後のステップは[Alexaスキルストア](http://amazon.com/skills)で利用されるメタデータの追加です。このページで必要な手順を解説します。また、申請時にありがちなミスを避ける方法について、いくつかヒントを提示します。
-
+1. [Amazon開発者ポータル](https://developer.amazon.com/edw/home.html#/skills/list)で **公開** タブを開きます。
-2. **Complete the Global Fields data.** These fields apply across all of the languges that your skill supports.
+2. 画面上のガイダンスに従ってそれぞれのフィールドを記入します。はてなマークにマウスカーソルをあてると、そのフィールドのヘルプがポップアップ表示されます。**アスタリスクマークのついたフィールドは必須です**
+ * 審査を無事通過するためにも、お時間をいただき正確な記入をお願いします。
-
+3. **スキルの説明**
- * **For Category, we are building a trivia skill, so select "Games, Trivia, and Accessories."** You will also be presented with a **Sub-Category** option. For this skill, choose "Knowledge and Trivia."
+ 魅力的で簡潔な説明文を入力してください。説明文はユーザにあなたのスキルの魅力を伝えるためのものです。最大限に活用しましょう。これらの説明文は[Alexaアプリ](http://alexa.amazon.co.jp/spa/index.html#skills)のスキル一覧ページに表示されます。
+
+4. **サンプルフレーズ**
- * **Provide testing instructions.** Testing instructions give you an opportunity to explain your skill, and any special or possibly confusing features, to the certification team. A value is required in this box.
+ ユーザーがスキルに話しかけるときに最も使われそうなフレーズを3つ入力します。
- * Since you are using our Trivia Sample, make sure to add this sentence to your Testing Instructions:
+ * **サンプルフレーズ** には、サンプル発話と完全に一致するものを入力してください。ここを間違えてしまったことで審査が通らなかったという例がよくあります。以下にサンプルフレーズを書くときに考慮すべき事項を記載しておきます。
- ```
- This was built using the Trivia Sample.
- ```
-
- This will let the testing team understand what you're providing them, and should decrease the testing time required.
-
- * **Countries and Region can be for "all countries", unless you have a specific reason to exclude a specific location.** This gives Amazon the ability to distribute your skill globally. Remember that you will need to create additional versions of your skill in the other available languages before they will be available in those countries.
-
-3. **Write your skill descriptions.**
-
-
-
- * **Spend some time coming up with an enticing, succinct description.** This is one of the few places you have an opportunity to attract new users, so make the most of it! These descriptions show up in the list of skills available in the [Alexa app](http://alexa.amazon.com/spa/index.html#skills).
-
-4. **For your example phrases, come up with the three most exciting ways a user can talk to your skill.**
-
-
-
- * **Make sure that each of your example phrases are a perfect match with one of your Sample Utterances.** Incorrect example phrases are one of the most common reasons that skills fail certification, so we have provided a short list of things to consider as you write your example phrases:
-
- | Common Failure Points for Example Phrases |
+ | サンプルフレーズを入力する際に考慮すべき事項 |
| ----------------------------------------- |
- | Example phrases **must** adhere to the [supported phrases](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/supported-phrases-to-begin-a-conversation). |
- | Example phrases **must** be based on sample utterances specified in your Intent Schema. |
- | Your first example phrase **must** include a wake word and your invocation name. |
- | Example phrases **must** provide a contextual response. |
-
- * **Choose three example phrases that are likely to be the most common ways that users will attempt to interact with your skill.** Make sure that each of them works well, and provides an excellent user experience.
-
-5. **Provide a comprehensive list of keywords for users that are searching for new skills.** This is an optional field, and searching the [Alexa app](http://alexa.amazon.com) will also find the words in your Skill Name and descriptions, so you don't need to overdo it. That being said, if there are words that you want users to find your skill with, you should include them here. Separate the keywords with commas.
+ | サンプルフレーズは[ユーザーによるカスタムスキルの呼び出し](https://developer.amazon.com/public/solutions/alexa/alexa-skills-kit/docs/supported-phrases-to-begin-a-conversation)に書かれているルールに沿っていること。 |
+ | サンプルフレーズは対話モデルで定義した **サンプル発話**に基づいたものであること。 |
+ | 1番目のサンプルフレーズは**ウェイクワードと呼び出し名**を含んでいること。 |
+ | サンプルフレーズは**適切な応答を返す**ものであること。 |
-
+ * ユーザーがスキルに話しかけるときに、最も使いそうなフレーズを3つ選んでください。どのフレーズも正常に動作し、素晴らしいユーザー体験を提供するようにしてください。
-6. **Create your skill's icons.** You need two sizes of your icon: 108x108px and 512x512px.
+5. **スキルアイコン**
-
+ スキルのアイコンは **108x108** ピクセルと **512x512** ピクセルの2通りのサイズを用意する必要があります。
- * **Make sure you have the rights to the icons you create.** Please don't violate any trademarks or copyrights.
- * **If you don't have software to make icons, try one of these free options:**
+ * 自分が権利を持っているものでアイコンを作成してください。商標やコピーライトを侵害しないようにしてください。
+ * アイコンを作成するソフトウェアをお持ちでない場合は、以下のような無料ソフトから選ぶと良いでしょう。
* [GIMP](https://www.gimp.org/) (Windows/Mac/Linux)
* [Paint.NET](http://www.getpaint.net/index.html) (Windows)
* [Inkscape](http://inkscape.org) (Windows/Mac/Linux)
* [Iconion](http://iconion.com/) (Windows/Mac)
- * To make it easier to get started, we've created blank versions of these icons in both sizes for many formats:
-
- * [PSD](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/psd._TTH_.zip)
- * [PNG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/png._TTH_.zip)
- * [GIF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/gif._TTH_.zip)
- * [PDF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdf._TTH_.zip)
- * [JPG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/jpg._TTH_.zip)
- * [SVG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/svg._TTH_.zip)
- * [PDN](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdn._TTH_.zip) - for [Paint.NET](http://www.getpaint.net/index.html)
- * [XCF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/xcf._TTH_.zip) - for [GIMP](https://www.gimp.org/)
-
-7. **Open the Privacy & Compliance tab on the left side of your skill in the [Developer Portal](https://developer.amazon.com/edw/home.html#/skills/list).**
-
-
+ * 各サイズのブランクのアイコンを様々なフォーマットでご用意しました。よろしければお使いください。
-8. **Answer each of the Global Fields questions using the guidance below.** These fields also apply across all of the languages that your skill supports.
+ * [PSD](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/psd.zip)
+ * [PNG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/png.zip)
+ * [GIF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/gif.zip)
+ * [PDF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdf.zip)
+ * [JPG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/jpg.zip)
+ * [SVG](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/svg.zip)
+ * [PDN](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/pdn.zip) - [Paint.NET](http://www.getpaint.net/index.html)用
+ * [XCF](https://m.media-amazon.com/images/G/01/mobile-apps/dex/alexa/alexa-skills-kit/tutorials/general/icon-templates/xcf.zip) - [GIMP](https://www.gimp.org/)用
-
+7. **キーワード** ユーザーがスキルを探すときに使うであろうキーワードを全て入力してください。これは項目は任意です。[Alexaアプリ](http://alexa.amazon.co.jp)での検索ではスキル名や説明文にある単語も検索対象となるため、入力を省略しても問題ありません。スキルを探すときにユーザーに使って欲しい単語がある場合は、それらのキーワードを入力してください。複数のキーワードはカンマで区切ってください。
- * **Does this skill allow users to make purchases or spend real money?** For this trivia skill, the answer is no. For future skills, make sure you answer this appropriately.
+8. **プライバシーポリシー URL** 必須項目ではありません。今回は空白のままで問題ありません。
- * **Does this Alexa skill collect users' personal information?** Again, for this trivia skill, the answer is no. If you do collect information about a user, such as names, email addresses, phone numbers, and so forth, ensure that you answer Yes to this question.
- * Answering "yes" to this question will also require you to provide a link to your Privacy Policy at the bottom of the page.
+9. **利用規約 URL** 必須項目ではありません。空白のままで問題ありません。
- * **Is your skill directed to children under the age of 13?** Because you customized this skill with data you provided, it is possible that you created a skill that targets children under the age of 13. For this trivia skill, the answer is **no** because it doesn't target a specific age group.
- * Factors to consider in determining if this skill is directed to children under 13 include:
- * Subject matter of the skill
- * Presence of child-oriented activities and incentives
- * Type of language used in the skill
- * Music and other audio content in the skill
- * How the skill is described and marketed
- * Intended audience for the skill
+10. 入力が完成したらページ下部の **保存して続行** ボタンをクリックし、**プライバシーとコンプライアンス** へ移動します。
- If you're not sure, please see the [FTC's COPPA Guidance and FAQ](https://www.ftc.gov/tips-advice/business-center/guidance/complying-coppa-frequently-asked-questions) for more information.
+11. **プライバシーとコンプライアンス**にある質問に下記のガイダンスに従いながら答えてください。
-9. **Export Compliance.** Be certain that you agree with all of the conditions. If you do, make sure to check this box, as Amazon requires this permission to distribute your skill around the globe.
+ * **このスキルを使って何かを購入したり、実際にお金を支払うことができますか?** 今回のスキルでは、**いいえ**を選択します。将来、あなたが作るスキルに適したオプションを選択してください。
-10. **Privacy Policy URL.** This is an optional field, and should not be required for this Trivia skill sample. You can leave it blank.
+ * **このスキルはユーザーの個人情報を収集しますか?** これについても今回のスキルでは、 **いいえ** を選択します。 もし、ユーザーの個人情報、例えば氏名やメールアドレス、電話番号等を収集しているのであれば、この質問に**はい**と答えてください。
+ * この質問に **はい**と答えた場合、プライバシーポリシーへのリンクを提供する必要があります。
-11. **Terms of Use URL.** This is also optional, and you can leave it blank.
+ * **このスキルは13際未満の子供を対象としたものですか?** このスキルのデータはあなたが用意したデータでカスタマイズされているので、13際未満の子供を対象にしているかもしれません。カスタマイズする前の状態のスキルの場合は特定の年齢層をターゲットとしたものではないので、 **いいえ** を選択します。
+ * このスキルが13際未満の子供向けかどうかを判断すには、以下の要素を考慮してみてください。
+ * スキルのテーマ
+ * 子供向けの内容が含まれているか
+ * スキル内の言葉遣い
+ * スキル内で利用されている音楽やその他おオーディオコンテンツ
+ * スキルがどのように説明されマーケティングされるか
+ * スキルの想定利用者層
-12. **Click the Save button at the bottom of the page.**
+12. **輸出コンプライアンス** 全ての項目に同意できるか確認してください。同意する場合はボックスにチェックをつけてください。Amazonがスキルを配布するためには、ここでの同意が必要です。
-
+13. **テストの手順** この欄は、あなたのスキルや、特殊だったり混乱しがちな機能を、認証チームに対して説明する機会となります。
-13. **Each checkmark should be green, as shown.**
+ * 今回はサンプリを使用しているので、テストの手順にその旨を記述してください。例:
-
+ ```text
+ これはFactサンプルをもとに作成しました。
+ ```
-14. **If you feel that your skill is ready for certification, click the "Submit for Certification" button at the bottom of the page.**
+ これによりテストチームがスキルの構造を理解しテスト時間を節約することができます。
-
+ **ノート:** 認証の詳細は [こちら](https://alexa.design/certification) を参照ください。
-15. **You're done with your submission!** Here are a few things you might need to know:
+14. 準備ができましたら **保存して続行** ボタンをクリックします。
- * **Certification can take several days to complete.** Please be patient. It takes time because we want to get it right.
- * **Did something go wrong?** Our team of evangelists run [online office hours every Tuesday from 1-2pm Pacific Time](https://attendee.gotowebinar.com/rt/8389200425172113931). They can help answer any questions you might have.
+15. お疲れさまでした。これで **申請完了です!**
- * **Want the coolest t-shirt you've ever seen?** Every month, we create a brand-new Alexa Developer t-shirt or hoodie, and send them out to developers that published a skill that month. [You can get yours here if you live in the US](https://developer.amazon.com/alexa-skills-kit/alexa-developer-skill-promotion), [here for the UK](https://developer.amazon.com/en-gb/alexa-skills-kit/alexa-developer-skill-promotion), and [here for Germany](https://developer.amazon.com/de-de/alexa-skills-kit/alexa-developer-skill-promotion).
+ * **認定には数日かかります。** 審査が完了するまでしばらくお待ちください。
-
+ * [スキル開発者への特典](https://developer.amazon.com/ja/alexa-skills-kit/alexa-developer-skill-promotion?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=trivia-nodejs-V2_GUI-6&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_trivia-nodejs-V2_GUI-6_Convert_WW_beginnersdevs&sc_segment=beginnersdevs)
+ もございますので、ご参照ください。
diff --git a/instructions/7-cli.md b/instructions/7-cli.md
new file mode 100644
index 0000000..cae1ed5
--- /dev/null
+++ b/instructions/7-cli.md
@@ -0,0 +1,96 @@
+# Alexa トリビアスキルの開発
+
+
+## ASK CLIを利用したセットアップ
+
+### 概要
+ここでは、あなたが CLI(コマンドラインインターフェイス)、[AWS](https://aws.amazon.com/)、[ASK(Alexa Skills Kit)開発者ポータル](https://developer.amazon.com/alexa-skills-kit?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Content&sc_detail=trivia-nodejs-V2_CLI-1&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Content_trivia-nodejs-V2_CLI-1_Convert_WW_beginnersdevs&sc_segment=beginnersdevs)につての知識と開発環境が準備されていることを前提としています。.準備がまだの場合は、 [こちら](./1-voice-user-interface.md) を参照してください.
+
+### 準備しておくべきこと
+
+* Node.js (バージョン 8 以上)
+* [AWSアカウント](https://aws.amazon.com/)の登録
+* [Amazon開発者アカウント](https://developer.amazon.com?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Content&sc_detail=trivia-nodejs-V2_CLI-1&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Content_trivia-nodejs-V2_CLI-1_Convert_WW_beginnersdevs&sc_segment=beginnersdevs)の登録
+* [ASK CLI](https://developer.amazon.com/docs/smapi/quick-start-alexa-skills-kit-command-line-interface.html?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Content&sc_detail=trivia-nodejs-V2_CLI-1&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Content_trivia-nodejs-V2_CLI-1_Convert_WW_beginnersdevs&sc_segment=beginnersdevs)の取得
+
+### インストール
+1. 最新版の **ASK CLI** を取得していることを確認してください。
+
+ ```bash
+ $ npm update -g ask-cli
+ ```
+
+2. レポジトリを **clone** してください。
+
+ ```bash
+ $ git clone https://github.com/alexa/skill-sample-nodejs-trivia/
+ ```
+
+3. 初回のご利用の場合、レポジトリ内で `ask init` コマンドを実行することで、 [ASK CLI](https://developer.amazon.com/docs/smapi/quick-start-alexa-skills-kit-command-line-interface.html?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Content&sc_detail=trivia-nodejs-V2_CLI-1&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Content_trivia-nodejs-V2_CLI-1_Convert_WW_beginnersdevs&sc_segment=beginnersdevs) を初期化してください。
+
+ ```bash
+ $ cd skill-sample-nodejs-trivia
+ $ ask init
+ ```
+
+4. `/lambda/custom` ディレクトリで、`npm install` コマンドを実行して、npn関連をインストールしてください。
+
+ ```bash
+ $ cd lambda/custom
+ $ npm install
+ ```
+
+### デプロイ
+
+ASK CLI はスキルとLambda関数を作成します。このLambda関数はデフォルトで```us-east-1 (Northern Virginia)```に作成されます。
+
+1. カレントディレクトリをプロジェクトのルートディレクトリにしてください。'skill.json' がそこにあるはずです。
+2. 次のコマンドを実行することで、スキルとLambda関数を一度でデプロイすることができます。
+
+ ```bash
+ $ ask deploy
+ ```
+
+### テスト
+
+1. テストをするには、そのスキルが有効化されている必要があります。`ask deploy` コマンドはデフォルトでそのスキルを有効化するのですが、`ask api enable-skill` コマンドにより手動で有効かすることもできます。[ドキュメント](https://developer.amazon.com/docs/smapi/ask-cli-command-reference.html#enable-skill-subcommand).
+
+ ```bash
+ $ ask api enable-skill --skill-id amzn1.ask.skill.00000000-0000-0000-0000-000000000000
+ ```
+
+2. スキルに対する対話をコマンドラインでシミュレートするには、次のようにコマンドを利用します。(少し時間がかかることがあります)
+
+ ```bash
+ $ ask simulate -l ja-JP -t "トナカイトリビアを開く"
+
+ ✓ Simulation created for simulation id: 4a7a9ed8-94b2-40c0-b3bd-fb63d9887fa7
+ ◡ Waiting for simulation response{
+ "status": "SUCCESSFUL",
+ ...
+ ```
+
+3. "Test"スイッチが有効になっていると、あなたのスキルは開発者アカウントに紐づいたどのデバイスでもテストすることができます。デバイスを使う代わりにブラウザを使った [Echosim.io](https://echosim.io/welcome)や、**Amazon Alexa** や **Amazon Music** などのモバイルアプリを利用することもできます。
+
+ ```text
+ アレクサ、トナカイトリビアを開いて
+ ```
+## カスタマイズ
+
+1. ```./skill.json```
+
+ スキル名、フレーズの例題、アイコン、テスト手順などを変更してみてください。
+
+ 多くの要素は地域・言語によって違ってくるかもしれませんのでご注意ください。
+
+ 詳しくは [スキルマニフェスト(スキル管理API)](https://developer.amazon.com/docs/smapi/skill-manifest.html?&sc_category=Owned&sc_channel=RD&sc_campaign=Evangelism2018&sc_publisher=github&sc_content=Survey&sc_detail=trivia-nodejs-V2_CLI-3&sc_funnel=Convert&sc_country=WW&sc_medium=Owned_RD_Evangelism2018_github_Survey_trivia-nodejs-V2_CLI-3_Convert_WW_beginnersdevs&sc_segment=beginnersdevs) をご参照ください。
+
+2. ```./lambda/custom/index.js```
+
+ ソースコード中に記述されているメッセージやトナカイのトリビアなど変更してみてください。
+
+3. ```./models/*.json```
+
+ **呼び出し名** やそれぞれのインテントに対する **サンプルフレーズ** などを編集してみてください。変更はサポートを予定している、それぞれの地域・言語毎に行う必要があります。
+
+4. 変更をしたときにはスキルとLambda関数を再デプロイすることをお忘れなく。
diff --git a/interactionModel.json b/interactionModel.json
deleted file mode 100644
index daa7a73..0000000
--- a/interactionModel.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "intents": [
- {
- "name": "AMAZON.CancelIntent",
- "samples": []
- },
- {
- "name": "AMAZON.HelpIntent",
- "samples": []
- },
- {
- "name": "AMAZON.StopIntent",
- "samples": []
- },
- {
- "name": "AnswerIntent",
- "samples": [
- "the answer is {Answer}",
- "my answer is {Answer}",
- "is it {Answer}",
- "{Answer} is my answer",
- "{Answer}"
- ],
- "slots": [
- {
- "name": "Answer",
- "type": "AMAZON.NUMBER",
- "samples": []
- }
- ]
- },
- {
- "name": "DontKnowIntent",
- "samples": [
- "i don't know",
- "don't know",
- "i don't know that one",
- "dunno",
- "skip",
- "i don't know that",
- "who knows",
- "i don't know this question"
- ],
- "slots": []
- }
- ]
-}
diff --git a/lambda/custom/index.js b/lambda/custom/index.js
old mode 100644
new mode 100755
index 46d3c5a..b13dad1
--- a/lambda/custom/index.js
+++ b/lambda/custom/index.js
@@ -1,388 +1,494 @@
/* eslint-disable func-names */
-/* eslint-disable dot-notation */
-/* eslint-disable new-cap */
-/* eslint quote-props: ['error', 'consistent']*/
-/**
- * This sample demonstrates a simple skill built with the Amazon Alexa Skills
- * nodejs skill development kit.
- * This sample supports en-US lauguage.
- * The Intent Schema, Custom Slots and Sample Utterances for this skill, as well
- * as testing instructions are located at https://github.com/alexa/skill-sample-nodejs-trivia
- **/
-
-'use strict';
-
-const Alexa = require('alexa-sdk');
-const questions = require('./question');
-
-const ANSWER_COUNT = 4; // The number of possible answers per trivia question.
-const GAME_LENGTH = 5; // The number of questions per trivia game.
-const GAME_STATES = {
- TRIVIA: '_TRIVIAMODE', // Asking trivia questions.
- START: '_STARTMODE', // Entry point, start the game.
- HELP: '_HELPMODE', // The user is asking for help.
-};
-const APP_ID = undefined; // TODO replace with your app ID (OPTIONAL)
+/* eslint-disable no-console */
+
+const Alexa = require('ask-sdk-core');
+const questions = require('./questions');
+const i18n = require('i18next');
+const sprintf = require('i18next-sprintf-postprocessor');
+
+const ANSWER_COUNT = 4;
+const GAME_LENGTH = 5;
+
+function populateGameQuestions(translatedQuestions) {
+ const gameQuestions = [];
+ const indexList = [];
+ let index = translatedQuestions.length;
+ if (GAME_LENGTH > index) {
+ throw new Error('Invalid Game Length.');
+ }
+
+ for (let i = 0; i < translatedQuestions.length; i += 1) {
+ indexList.push(i);
+ }
+
+ for (let j = 0; j < GAME_LENGTH; j += 1) {
+ const rand = Math.floor(Math.random() * index);
+ index -= 1;
+
+ const temp = indexList[index];
+ indexList[index] = indexList[rand];
+ indexList[rand] = temp;
+ gameQuestions.push(indexList[index]);
+ }
+ return gameQuestions;
+}
+
+function populateRoundAnswers(
+ gameQuestionIndexes,
+ correctAnswerIndex,
+ correctAnswerTargetLocation,
+ translatedQuestions
+) {
+ const answers = [];
+ const translatedQuestion = translatedQuestions[gameQuestionIndexes[correctAnswerIndex]];
+ const answersCopy = translatedQuestion[Object.keys(translatedQuestion)[0]].slice();
+ let index = answersCopy.length;
+
+ if (index < ANSWER_COUNT) {
+ throw new Error('Not enough answers for question.');
+ }
+
+ // Shuffle the answers, excluding the first element which is the correct answer.
+ for (let j = 1; j < answersCopy.length; j += 1) {
+ const rand = Math.floor(Math.random() * (index - 1)) + 1;
+ index -= 1;
+
+ const swapTemp1 = answersCopy[index];
+ answersCopy[index] = answersCopy[rand];
+ answersCopy[rand] = swapTemp1;
+ }
+
+ // Swap the correct answer into the target location
+ for (let i = 0; i < ANSWER_COUNT; i += 1) {
+ answers[i] = answersCopy[i];
+ }
+ const swapTemp2 = answers[0];
+ answers[0] = answers[correctAnswerTargetLocation];
+ answers[correctAnswerTargetLocation] = swapTemp2;
+ return answers;
+}
-/**
- * When editing your questions pay attention to your punctuation. Make sure you use question marks or periods.
- * Make sure the first answer is the correct one. Set at least ANSWER_COUNT answers, any extras will be shuffled in.
- */
+function isAnswerSlotValid(intent) {
+ const answerSlotFilled = intent
+ && intent.slots
+ && intent.slots.Answer
+ && intent.slots.Answer.value;
+ const answerSlotIsInt = answerSlotFilled
+ && !Number.isNaN(parseInt(intent.slots.Answer.value, 10));
+ return answerSlotIsInt
+ && parseInt(intent.slots.Answer.value, 10) < (ANSWER_COUNT + 1)
+ && parseInt(intent.slots.Answer.value, 10) > 0;
+}
+
+function handleUserGuess(userGaveUp, handlerInput) {
+ const { requestEnvelope, attributesManager, responseBuilder } = handlerInput;
+ const { intent } = requestEnvelope.request;
+
+ const answerSlotValid = isAnswerSlotValid(intent);
+
+ let speechOutput = '';
+ let speechOutputAnalysis = '';
+
+ const sessionAttributes = attributesManager.getSessionAttributes();
+ const gameQuestions = sessionAttributes.questions;
+ let correctAnswerIndex = parseInt(sessionAttributes.correctAnswerIndex, 10);
+ let currentScore = parseInt(sessionAttributes.score, 10);
+ let currentQuestionIndex = parseInt(sessionAttributes.currentQuestionIndex, 10);
+ const { correctAnswerText } = sessionAttributes;
+ const requestAttributes = attributesManager.getRequestAttributes();
+ const translatedQuestions = requestAttributes.t('QUESTIONS');
+
+
+ if (answerSlotValid
+ && parseInt(intent.slots.Answer.value, 10) === sessionAttributes.correctAnswerIndex) {
+ currentScore += 1;
+ speechOutputAnalysis = requestAttributes.t('ANSWER_CORRECT_MESSAGE');
+ } else {
+ if (!userGaveUp) {
+ speechOutputAnalysis = requestAttributes.t('ANSWER_WRONG_MESSAGE');
+ }
+
+ speechOutputAnalysis += requestAttributes.t(
+ 'CORRECT_ANSWER_MESSAGE',
+ correctAnswerIndex,
+ correctAnswerText
+ );
+ }
+
+ // Check if we can exit the game session after GAME_LENGTH questions (zero-indexed)
+ if (sessionAttributes.currentQuestionIndex === GAME_LENGTH - 1) {
+ speechOutput = userGaveUp ? '' : requestAttributes.t('ANSWER_IS_MESSAGE');
+ speechOutput += speechOutputAnalysis + requestAttributes.t(
+ 'GAME_OVER_MESSAGE',
+ currentScore.toString(),
+ GAME_LENGTH.toString()
+ );
+
+ return responseBuilder
+ .speak(speechOutput)
+ .getResponse();
+ }
+ currentQuestionIndex += 1;
+ correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT));
+ const spokenQuestion = Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0];
+ const roundAnswers = populateRoundAnswers(
+ gameQuestions,
+ currentQuestionIndex,
+ correctAnswerIndex,
+ translatedQuestions
+ );
+ const questionIndexForSpeech = currentQuestionIndex + 1;
+ let repromptText = requestAttributes.t(
+ 'TELL_QUESTION_MESSAGE',
+ questionIndexForSpeech.toString(),
+ spokenQuestion
+ );
+
+ for (let i = 0; i < ANSWER_COUNT; i += 1) {
+ repromptText += `${i + 1}. ${roundAnswers[i]}. `;
+ }
+
+ speechOutput += userGaveUp ? '' : requestAttributes.t('ANSWER_IS_MESSAGE');
+ speechOutput += speechOutputAnalysis
+ + requestAttributes.t('SCORE_IS_MESSAGE', currentScore.toString())
+ + repromptText;
+
+ const translatedQuestion = translatedQuestions[gameQuestions[currentQuestionIndex]];
+
+ Object.assign(sessionAttributes, {
+ speechOutput: repromptText,
+ repromptText,
+ currentQuestionIndex,
+ correctAnswerIndex: correctAnswerIndex + 1,
+ questions: gameQuestions,
+ score: currentScore,
+ correctAnswerText: translatedQuestion[Object.keys(translatedQuestion)[0]][0]
+ });
+
+ return responseBuilder.speak(speechOutput)
+ .reprompt(repromptText)
+ .withSimpleCard(requestAttributes.t('GAME_NAME'), repromptText)
+ .getResponse();
+}
+
+function startGame(newGame, handlerInput) {
+ const requestAttributes = handlerInput.attributesManager.getRequestAttributes();
+ let speechOutput = newGame
+ ? requestAttributes.t('NEW_GAME_MESSAGE', requestAttributes.t('GAME_NAME'))
+ + requestAttributes.t('WELCOME_MESSAGE', GAME_LENGTH.toString())
+ : '';
+ const translatedQuestions = requestAttributes.t('QUESTIONS');
+ const gameQuestions = populateGameQuestions(translatedQuestions);
+ const correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT));
+
+ const roundAnswers = populateRoundAnswers(
+ gameQuestions,
+ 0,
+ correctAnswerIndex,
+ translatedQuestions
+ );
+ const currentQuestionIndex = 0;
+ const spokenQuestion = Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0];
+ let repromptText = requestAttributes.t('TELL_QUESTION_MESSAGE', '1', spokenQuestion);
+ for (let i = 0; i < ANSWER_COUNT; i += 1) {
+ repromptText += `${i + 1}. ${roundAnswers[i]}. `;
+ }
+
+ speechOutput += repromptText;
+ const sessionAttributes = {};
+
+ const translatedQuestion = translatedQuestions[gameQuestions[currentQuestionIndex]];
+
+ Object.assign(sessionAttributes, {
+ speechOutput: repromptText,
+ repromptText,
+ currentQuestionIndex,
+ correctAnswerIndex: correctAnswerIndex + 1,
+ questions: gameQuestions,
+ score: 0,
+ correctAnswerText: translatedQuestion[Object.keys(translatedQuestion)[0]][0]
+ });
+
+ handlerInput.attributesManager.setSessionAttributes(sessionAttributes);
+
+ return handlerInput.responseBuilder
+ .speak(speechOutput)
+ .reprompt(repromptText)
+ .withSimpleCard(requestAttributes.t('GAME_NAME'), repromptText)
+ .getResponse();
+}
+
+function helpTheUser(newGame, handlerInput) {
+ const requestAttributes = handlerInput.attributesManager.getRequestAttributes();
+ const askMessage = newGame
+ ? requestAttributes.t('ASK_MESSAGE_START')
+ : requestAttributes.t('REPEAT_QUESTION_MESSAGE') + requestAttributes.t('STOP_MESSAGE');
+ const speechOutput = requestAttributes.t('HELP_MESSAGE', GAME_LENGTH) + askMessage;
+ const repromptText = requestAttributes.t('HELP_REPROMPT') + askMessage;
+
+ return handlerInput.responseBuilder.speak(speechOutput).reprompt(repromptText).getResponse();
+}
+
+/* jshint -W101 */
const languageString = {
- 'en': {
- 'translation': {
- 'QUESTIONS': questions['QUESTIONS_EN_US'],
- 'GAME_NAME': 'Reindeer Trivia', // Be sure to change this for your skill.
- 'HELP_MESSAGE': 'I will ask you %s multiple choice questions. Respond with the number of the answer. ' +
- 'For example, say one, two, three, or four. To start a new game at any time, say, start game. ',
- 'REPEAT_QUESTION_MESSAGE': 'To repeat the last question, say, repeat. ',
- 'ASK_MESSAGE_START': 'Would you like to start playing?',
- 'HELP_REPROMPT': 'To give an answer to a question, respond with the number of the answer. ',
- 'STOP_MESSAGE': 'Would you like to keep playing?',
- 'CANCEL_MESSAGE': 'Ok, let\'s play again soon.',
- 'NO_MESSAGE': 'Ok, we\'ll play another time. Goodbye!',
- 'TRIVIA_UNHANDLED': 'Try saying a number between 1 and %s',
- 'HELP_UNHANDLED': 'Say yes to continue, or no to end the game.',
- 'START_UNHANDLED': 'Say start to start a new game.',
- 'NEW_GAME_MESSAGE': 'Welcome to %s. ',
- 'WELCOME_MESSAGE': 'I will ask you %s questions, try to get as many right as you can. ' +
- 'Just say the number of the answer. Let\'s begin. ',
- 'ANSWER_CORRECT_MESSAGE': 'correct. ',
- 'ANSWER_WRONG_MESSAGE': 'wrong. ',
- 'CORRECT_ANSWER_MESSAGE': 'The correct answer is %s: %s. ',
- 'ANSWER_IS_MESSAGE': 'That answer is ',
- 'TELL_QUESTION_MESSAGE': 'Question %s. %s ',
- 'GAME_OVER_MESSAGE': 'You got %s out of %s questions correct. Thank you for playing!',
- 'SCORE_IS_MESSAGE': 'Your score is %s. ',
- },
+ ja: {
+ translation: {
+ QUESTIONS : questions.QUESTIONS_JA_JP,
+ GAME_NAME : "トナカイトリビア",
+ HELP_MESSAGE: "これから%s問のクイズを出します。 正解だと思う番号を回答してください。例えば、 「答えは3番」という風に回答してください。 最初からゲームをやり直したい場合は「ニューゲーム」と言ってください。 ",
+ REPEAT_QUESTION_MESSAGE: "質問を聞き直したい場合は「もう一回」と言ってください。 ",
+ ASK_MESSAGE_START: "ゲームを始めますか? ",
+ HELP_REPROMPT: "正解だと思う番号を回答してください。 ",
+ STOP_MESSAGE: "ゲームを続けますか? ",
+ CANCEL_MESSAGE: "また遊んでくださいね。 ",
+ NO_MESSAGE: "また今度遊んでくださいね。ご機嫌よう。 ",
+ TRIVIA_UNHANDLED: "1番から%s番までの番号で回答してください。 ",
+ HELP_UNHANDLED: "ゲームを続ける場合は「はい」と、終わる場合は「いいえ」と答えてください。 ",
+ START_UNHANDLED: "最初からゲームを始める場合は「ニューゲーム」と言ってください。 ",
+ NEW_GAME_MESSAGE: "%sへようこそ。 ",
+ WELCOME_MESSAGE: "これから%s問のクイズを出します。 何問正解できるか挑戦してみてください。回答は番号で行ってください。さあ始めましょう。 ",
+ ANSWER_CORRECT_MESSAGE: "正解。 ",
+ ANSWER_WRONG_MESSAGE: "残念、不正解。 ",
+ CORRECT_ANSWER_MESSAGE: "正解は%s番。 %s ",
+ ANSWER_IS_MESSAGE: " ",
+ TELL_QUESTION_MESSAGE: "第%s問。 %s ",
+ GAME_OVER_MESSAGE: "あなたの点数は%s点でした。 問題数は%s問でした。 遊んでくれてありがとう。 ",
+ SCORE_IS_MESSAGE: "現在の点数は%s点です。. "
},
- 'en-US': {
- 'translation': {
- 'QUESTIONS': questions['QUESTIONS_EN_US'],
- 'GAME_NAME': 'American Reindeer Trivia', // Be sure to change this for your skill.
- },
+ },
+ en: {
+ translation: {
+ QUESTIONS: questions.QUESTIONS_EN_US,
+ GAME_NAME: 'Reindeer Trivia',
+ HELP_MESSAGE: 'I will ask you %s multiple choice questions. Respond with the number of the answer. For example, say one, two, three, or four. To start a new game at any time, say, start game. ',
+ REPEAT_QUESTION_MESSAGE: 'To repeat the last question, say, repeat. ',
+ ASK_MESSAGE_START: 'Would you like to start playing?',
+ HELP_REPROMPT: 'To give an answer to a question, respond with the number of the answer. ',
+ STOP_MESSAGE: 'Would you like to keep playing?',
+ CANCEL_MESSAGE: 'Ok, let\'s play again soon.',
+ NO_MESSAGE: 'Ok, we\'ll play another time. Goodbye!',
+ TRIVIA_UNHANDLED: 'Try saying a number between 1 and %s',
+ HELP_UNHANDLED: 'Say yes to continue, or no to end the game.',
+ START_UNHANDLED: 'Say start to start a new game.',
+ NEW_GAME_MESSAGE: 'Welcome to %s. ',
+ WELCOME_MESSAGE: 'I will ask you %s questions, try to get as many right as you can. Just say the number of the answer. Let\'s begin. ',
+ ANSWER_CORRECT_MESSAGE: 'correct. ',
+ ANSWER_WRONG_MESSAGE: 'wrong. ',
+ CORRECT_ANSWER_MESSAGE: 'The correct answer is %s: %s. ',
+ ANSWER_IS_MESSAGE: 'That answer is ',
+ TELL_QUESTION_MESSAGE: 'Question %s. %s ',
+ GAME_OVER_MESSAGE: 'You got %s out of %s questions correct. Thank you for playing!',
+ SCORE_IS_MESSAGE: 'Your score is %s. '
},
- 'en-GB': {
- 'translation': {
- 'QUESTIONS': questions['QUESTIONS_EN_GB'],
- 'GAME_NAME': 'British Reindeer Trivia', // Be sure to change this for your skill.
- },
+ },
+ 'ja-JP': {
+ translation: {
+ QUESTIONS: questions.QUESTIONS_JA_JP,
+ GAME_NAME: '日本語トナカイトリビア'
},
- 'de': {
- 'translation': {
- 'QUESTIONS': questions['QUESTIONS_DE_DE'],
- 'GAME_NAME': 'Wissenswertes über Rentiere in Deutsch', // Be sure to change this for your skill.
- 'HELP_MESSAGE': 'Ich stelle dir %s Multiple-Choice-Fragen. Antworte mit der Zahl, die zur richtigen Antwort gehört. ' +
- 'Sage beispielsweise eins, zwei, drei oder vier. Du kannst jederzeit ein neues Spiel beginnen, sage einfach „Spiel starten“. ',
- 'REPEAT_QUESTION_MESSAGE': 'Wenn die letzte Frage wiederholt werden soll, sage „Wiederholen“ ',
- 'ASK_MESSAGE_START': 'Möchten Sie beginnen?',
- 'HELP_REPROMPT': 'Wenn du eine Frage beantworten willst, antworte mit der Zahl, die zur richtigen Antwort gehört. ',
- 'STOP_MESSAGE': 'Möchtest du weiterspielen?',
- 'CANCEL_MESSAGE': 'OK, dann lass uns bald mal wieder spielen.',
- 'NO_MESSAGE': 'OK, spielen wir ein andermal. Auf Wiedersehen!',
- 'TRIVIA_UNHANDLED': 'Sagt eine Zahl beispielsweise zwischen 1 und %s',
- 'HELP_UNHANDLED': 'Sage ja, um fortzufahren, oder nein, um das Spiel zu beenden.',
- 'START_UNHANDLED': 'Du kannst jederzeit ein neues Spiel beginnen, sage einfach „Spiel starten“.',
- 'NEW_GAME_MESSAGE': 'Willkommen bei %s. ',
- 'WELCOME_MESSAGE': 'Ich stelle dir %s Fragen und du versuchst, so viele wie möglich richtig zu beantworten. ' +
- 'Sage einfach die Zahl, die zur richtigen Antwort passt. Fangen wir an. ',
- 'ANSWER_CORRECT_MESSAGE': 'Richtig. ',
- 'ANSWER_WRONG_MESSAGE': 'Falsch. ',
- 'CORRECT_ANSWER_MESSAGE': 'Die richtige Antwort ist %s: %s. ',
- 'ANSWER_IS_MESSAGE': 'Diese Antwort ist ',
- 'TELL_QUESTION_MESSAGE': 'Frage %s. %s ',
- 'GAME_OVER_MESSAGE': 'Du hast %s von %s richtig beantwortet. Danke fürs Mitspielen!',
- 'SCORE_IS_MESSAGE': 'Dein Ergebnis ist %s. ',
- },
+ },
+ 'en-US': {
+ translation: {
+ QUESTIONS: questions.QUESTIONS_EN_US,
+ GAME_NAME: 'American Reindeer Trivia'
},
+ },
};
-const newSessionHandlers = {
- 'LaunchRequest': function () {
- this.handler.state = GAME_STATES.START;
- this.emitWithState('StartGame', true);
- },
- 'AMAZON.StartOverIntent': function () {
- this.handler.state = GAME_STATES.START;
- this.emitWithState('StartGame', true);
- },
- 'AMAZON.HelpIntent': function () {
- this.handler.state = GAME_STATES.HELP;
- this.emitWithState('helpTheUser', true);
- },
- 'Unhandled': function () {
- const speechOutput = this.t('START_UNHANDLED');
- this.response.speak(speechOutput).listen(speechOutput);
- this.emit(':responseReady');
- },
-};
-function populateGameQuestions(translatedQuestions) {
- const gameQuestions = [];
- const indexList = [];
- let index = translatedQuestions.length;
+const LocalizationInterceptor = {
+ process(handlerInput) {
+ const localizationClient = i18n.use(sprintf).init({
+ lng: handlerInput.requestEnvelope.request.locale,
+ overloadTranslationOptionHandler: sprintf.overloadTranslationOptionHandler,
+ resources: languageString,
+ returnObjects: true
+ });
+
+ const attributes = handlerInput.attributesManager.getRequestAttributes();
+ attributes.t = function (...args) {
+ return localizationClient.t(...args);
+ };
+ },
+};
- if (GAME_LENGTH > index) {
- throw new Error('Invalid Game Length.');
- }
+const LaunchRequest = {
+ canHandle(handlerInput) {
+ const { request } = handlerInput.requestEnvelope;
+
+ return request.type === 'LaunchRequest'
+ || (request.type === 'IntentRequest'
+ && request.intent.name === 'AMAZON.StartOverIntent');
+ },
+ handle(handlerInput) {
+ return startGame(true, handlerInput);
+ },
+};
- for (let i = 0; i < translatedQuestions.length; i++) {
- indexList.push(i);
- }
- // Pick GAME_LENGTH random questions from the list to ask the user, make sure there are no repeats.
- for (let j = 0; j < GAME_LENGTH; j++) {
- const rand = Math.floor(Math.random() * index);
- index -= 1;
+const HelpIntent = {
+ canHandle(handlerInput) {
+ const { request } = handlerInput.requestEnvelope;
- const temp = indexList[index];
- indexList[index] = indexList[rand];
- indexList[rand] = temp;
- gameQuestions.push(indexList[index]);
- }
+ return request.type === 'IntentRequest' && request.intent.name === 'AMAZON.HelpIntent';
+ },
+ handle(handlerInput) {
+ const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
- return gameQuestions;
-}
+ const newGame = !(sessionAttributes.questions);
+ return helpTheUser(newGame, handlerInput);
+ },
+};
-/**
- * Get the answers for a given question, and place the correct answer at the spot marked by the
- * correctAnswerTargetLocation variable. Note that you can have as many answers as you want but
- * only ANSWER_COUNT will be selected.
- * */
-function populateRoundAnswers(gameQuestionIndexes, correctAnswerIndex, correctAnswerTargetLocation, translatedQuestions) {
- const answers = [];
- const answersCopy = translatedQuestions[gameQuestionIndexes[correctAnswerIndex]][Object.keys(translatedQuestions[gameQuestionIndexes[correctAnswerIndex]])[0]].slice();
- let index = answersCopy.length;
-
- if (index < ANSWER_COUNT) {
- throw new Error('Not enough answers for question.');
+const UnhandledIntent = {
+ canHandle() {
+ return true;
+ },
+ handle(handlerInput) {
+ const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
+ const requestAttributes = handlerInput.attributesManager.getRequestAttributes();
+ if (Object.keys(sessionAttributes).length === 0) {
+ const speechOutput = requestAttributes.t('START_UNHANDLED');
+ return handlerInput.attributesManager
+ .speak(speechOutput)
+ .reprompt(speechOutput)
+ .getResponse();
+ } else if (sessionAttributes.questions) {
+ const speechOutput = requestAttributes.t('TRIVIA_UNHANDLED', ANSWER_COUNT.toString());
+ return handlerInput.attributesManager
+ .speak(speechOutput)
+ .reprompt(speechOutput)
+ .getResponse();
}
+ const speechOutput = requestAttributes.t('HELP_UNHANDLED');
+ return handlerInput.attributesManager.speak(speechOutput).reprompt(speechOutput).getResponse();
+ },
+};
- // Shuffle the answers, excluding the first element which is the correct answer.
- for (let j = 1; j < answersCopy.length; j++) {
- const rand = Math.floor(Math.random() * (index - 1)) + 1;
- index -= 1;
+const SessionEndedRequest = {
+ canHandle(handlerInput) {
+ return handlerInput.requestEnvelope.request.type === 'SessionEndedRequest';
+ },
+ handle(handlerInput) {
+ console.log(`Session ended with reason: ${handlerInput.requestEnvelope.request.reason}`);
- const swapTemp1 = answersCopy[index];
- answersCopy[index] = answersCopy[rand];
- answersCopy[rand] = swapTemp1;
- }
+ return handlerInput.responseBuilder.getResponse();
+ },
+};
- // Swap the correct answer into the target location
- for (let i = 0; i < ANSWER_COUNT; i++) {
- answers[i] = answersCopy[i];
+const AnswerIntent = {
+ canHandle(handlerInput) {
+ return handlerInput.requestEnvelope.request.type === 'IntentRequest'
+ && (handlerInput.requestEnvelope.request.intent.name === 'AnswerIntent'
+ || handlerInput.requestEnvelope.request.intent.name === 'DontKnowIntent');
+ },
+ handle(handlerInput) {
+ if (handlerInput.requestEnvelope.request.intent.name === 'AnswerIntent') {
+ return handleUserGuess(false, handlerInput);
}
- const swapTemp2 = answers[0];
- answers[0] = answers[correctAnswerTargetLocation];
- answers[correctAnswerTargetLocation] = swapTemp2;
- return answers;
-}
+ return handleUserGuess(true, handlerInput);
+ },
+};
-function isAnswerSlotValid(intent) {
- const answerSlotFilled = intent && intent.slots && intent.slots.Answer && intent.slots.Answer.value;
- const answerSlotIsInt = answerSlotFilled && !isNaN(parseInt(intent.slots.Answer.value, 10));
- return answerSlotIsInt
- && parseInt(intent.slots.Answer.value, 10) < (ANSWER_COUNT + 1)
- && parseInt(intent.slots.Answer.value, 10) > 0;
-}
+const RepeatIntent = {
+ canHandle(handlerInput) {
+ return handlerInput.requestEnvelope.request.type === 'IntentRequest'
+ && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.RepeatIntent';
+ },
+ handle(handlerInput) {
+ const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
+ return handlerInput.responseBuilder.speak(sessionAttributes.speechOutput)
+ .reprompt(sessionAttributes.repromptText)
+ .getResponse();
+ },
+};
-function handleUserGuess(userGaveUp) {
- const answerSlotValid = isAnswerSlotValid(this.event.request.intent);
- let speechOutput = '';
- let speechOutputAnalysis = '';
- const gameQuestions = this.attributes.questions;
- let correctAnswerIndex = parseInt(this.attributes.correctAnswerIndex, 10);
- let currentScore = parseInt(this.attributes.score, 10);
- let currentQuestionIndex = parseInt(this.attributes.currentQuestionIndex, 10);
- const correctAnswerText = this.attributes.correctAnswerText;
- const translatedQuestions = this.t('QUESTIONS');
-
- if (answerSlotValid && parseInt(this.event.request.intent.slots.Answer.value, 10) === this.attributes['correctAnswerIndex']) {
- currentScore++;
- speechOutputAnalysis = this.t('ANSWER_CORRECT_MESSAGE');
- } else {
- if (!userGaveUp) {
- speechOutputAnalysis = this.t('ANSWER_WRONG_MESSAGE');
- }
-
- speechOutputAnalysis += this.t('CORRECT_ANSWER_MESSAGE', correctAnswerIndex, correctAnswerText);
+const YesIntent = {
+ canHandle(handlerInput) {
+ return handlerInput.requestEnvelope.request.type === 'IntentRequest'
+ && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.YesIntent';
+ },
+ handle(handlerInput) {
+ const sessionAttributes = handlerInput.attributesManager.getSessionAttributes();
+ if (sessionAttributes.questions) {
+ return handlerInput.responseBuilder.speak(sessionAttributes.speechOutput)
+ .reprompt(sessionAttributes.repromptText)
+ .getResponse();
}
+ return startGame(false, handlerInput);
+ },
+};
- // Check if we can exit the game session after GAME_LENGTH questions (zero-indexed)
- if (this.attributes['currentQuestionIndex'] === GAME_LENGTH - 1) {
- speechOutput = userGaveUp ? '' : this.t('ANSWER_IS_MESSAGE');
- speechOutput += speechOutputAnalysis + this.t('GAME_OVER_MESSAGE', currentScore.toString(), GAME_LENGTH.toString());
-
- this.response.speak(speechOutput);
- this.emit(':responseReady');
- } else {
- currentQuestionIndex += 1;
- correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT));
- const spokenQuestion = Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0];
- const roundAnswers = populateRoundAnswers.call(this, gameQuestions, currentQuestionIndex, correctAnswerIndex, translatedQuestions);
- const questionIndexForSpeech = currentQuestionIndex + 1;
- let repromptText = this.t('TELL_QUESTION_MESSAGE', questionIndexForSpeech.toString(), spokenQuestion);
-
- for (let i = 0; i < ANSWER_COUNT; i++) {
- repromptText += `${i + 1}. ${roundAnswers[i]}. `;
- }
-
- speechOutput += userGaveUp ? '' : this.t('ANSWER_IS_MESSAGE');
- speechOutput += speechOutputAnalysis + this.t('SCORE_IS_MESSAGE', currentScore.toString()) + repromptText;
-
- Object.assign(this.attributes, {
- 'speechOutput': repromptText,
- 'repromptText': repromptText,
- 'currentQuestionIndex': currentQuestionIndex,
- 'correctAnswerIndex': correctAnswerIndex + 1,
- 'questions': gameQuestions,
- 'score': currentScore,
- 'correctAnswerText': translatedQuestions[gameQuestions[currentQuestionIndex]][Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0]][0],
- });
-
- this.response.speak(speechOutput).listen(repromptText);
- this.response.cardRenderer(this.t('GAME_NAME', repromptText));
- this.emit(':responseReady');
- }
-}
-const startStateHandlers = Alexa.CreateStateHandler(GAME_STATES.START, {
- 'StartGame': function (newGame) {
- let speechOutput = newGame ? this.t('NEW_GAME_MESSAGE', this.t('GAME_NAME')) + this.t('WELCOME_MESSAGE', GAME_LENGTH.toString()) : '';
- // Select GAME_LENGTH questions for the game
- const translatedQuestions = this.t('QUESTIONS');
- const gameQuestions = populateGameQuestions(translatedQuestions);
- // Generate a random index for the correct answer, from 0 to 3
- const correctAnswerIndex = Math.floor(Math.random() * (ANSWER_COUNT));
- // Select and shuffle the answers for each question
- const roundAnswers = populateRoundAnswers(gameQuestions, 0, correctAnswerIndex, translatedQuestions);
- const currentQuestionIndex = 0;
- const spokenQuestion = Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0];
- let repromptText = this.t('TELL_QUESTION_MESSAGE', '1', spokenQuestion);
-
- for (let i = 0; i < ANSWER_COUNT; i++) {
- repromptText += `${i + 1}. ${roundAnswers[i]}. `;
- }
-
- speechOutput += repromptText;
-
- Object.assign(this.attributes, {
- 'speechOutput': repromptText,
- 'repromptText': repromptText,
- 'currentQuestionIndex': currentQuestionIndex,
- 'correctAnswerIndex': correctAnswerIndex + 1,
- 'questions': gameQuestions,
- 'score': 0,
- 'correctAnswerText': translatedQuestions[gameQuestions[currentQuestionIndex]][Object.keys(translatedQuestions[gameQuestions[currentQuestionIndex]])[0]][0],
- });
-
- // Set the current state to trivia mode. The skill will now use handlers defined in triviaStateHandlers
- this.handler.state = GAME_STATES.TRIVIA;
-
- this.response.speak(speechOutput).listen(repromptText);
- this.response.cardRenderer(this.t('GAME_NAME'), repromptText);
- this.emit(':responseReady');
- },
-});
+const StopIntent = {
+ canHandle(handlerInput) {
+ return handlerInput.requestEnvelope.request.type === 'IntentRequest'
+ && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.StopIntent';
+ },
+ handle(handlerInput) {
+ const requestAttributes = handlerInput.attributesManager.getRequestAttributes();
+ const speechOutput = requestAttributes.t('STOP_MESSAGE');
-const triviaStateHandlers = Alexa.CreateStateHandler(GAME_STATES.TRIVIA, {
- 'AnswerIntent': function () {
- handleUserGuess.call(this, false);
- },
- 'DontKnowIntent': function () {
- handleUserGuess.call(this, true);
- },
- 'AMAZON.StartOverIntent': function () {
- this.handler.state = GAME_STATES.START;
- this.emitWithState('StartGame', false);
- },
- 'AMAZON.RepeatIntent': function () {
- this.response.speak(this.attributes['speechOutput']).listen(this.attributes['repromptText']);
- this.emit(':responseReady');
- },
- 'AMAZON.HelpIntent': function () {
- this.handler.state = GAME_STATES.HELP;
- this.emitWithState('helpTheUser', false);
- },
- 'AMAZON.StopIntent': function () {
- this.handler.state = GAME_STATES.HELP;
- const speechOutput = this.t('STOP_MESSAGE');
- this.response.speak(speechOutput).listen(speechOutput);
- this.emit(':responseReady');
- },
- 'AMAZON.CancelIntent': function () {
- this.response.speak(this.t('CANCEL_MESSAGE'));
- this.emit(':responseReady');
- },
- 'Unhandled': function () {
- const speechOutput = this.t('TRIVIA_UNHANDLED', ANSWER_COUNT.toString());
- this.response.speak(speechOutput).listen(speechOutput);
- this.emit(':responseReady');
- },
- 'SessionEndedRequest': function () {
- console.log(`Session ended in trivia state: ${this.event.request.reason}`);
- },
-});
+ return handlerInput.responseBuilder.speak(speechOutput)
+ .reprompt(speechOutput)
+ .getResponse();
+ },
+};
-const helpStateHandlers = Alexa.CreateStateHandler(GAME_STATES.HELP, {
- 'helpTheUser': function (newGame) {
- const askMessage = newGame ? this.t('ASK_MESSAGE_START') : this.t('REPEAT_QUESTION_MESSAGE') + this.t('STOP_MESSAGE');
- const speechOutput = this.t('HELP_MESSAGE', GAME_LENGTH) + askMessage;
- const repromptText = this.t('HELP_REPROMPT') + askMessage;
+const CancelIntent = {
+ canHandle(handlerInput) {
+ return handlerInput.requestEnvelope.request.type === 'IntentRequest'
+ && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.CancelIntent';
+ },
+ handle(handlerInput) {
+ const requestAttributes = handlerInput.attributesManager.getRequestAttributes();
+ const speechOutput = requestAttributes.t('CANCEL_MESSAGE');
+
+ return handlerInput.responseBuilder.speak(speechOutput)
+ .getResponse();
+ },
+};
- this.response.speak(speechOutput).listen(repromptText);
- this.emit(':responseReady');
- },
- 'AMAZON.StartOverIntent': function () {
- this.handler.state = GAME_STATES.START;
- this.emitWithState('StartGame', false);
- },
- 'AMAZON.RepeatIntent': function () {
- const newGame = !(this.attributes['speechOutput'] && this.attributes['repromptText']);
- this.emitWithState('helpTheUser', newGame);
- },
- 'AMAZON.HelpIntent': function () {
- const newGame = !(this.attributes['speechOutput'] && this.attributes['repromptText']);
- this.emitWithState('helpTheUser', newGame);
- },
- 'AMAZON.YesIntent': function () {
- if (this.attributes['speechOutput'] && this.attributes['repromptText']) {
- this.handler.state = GAME_STATES.TRIVIA;
- this.emitWithState('AMAZON.RepeatIntent');
- } else {
- this.handler.state = GAME_STATES.START;
- this.emitWithState('StartGame', false);
- }
- },
- 'AMAZON.NoIntent': function () {
- const speechOutput = this.t('NO_MESSAGE');
- this.response.speak(speechOutput);
- this.emit(':responseReady');
- },
- 'AMAZON.StopIntent': function () {
- const speechOutput = this.t('STOP_MESSAGE');
- this.response.speak(speechOutput).listen(speechOutput);
- this.emit(':responseReady');
- },
- 'AMAZON.CancelIntent': function () {
- this.response.speak(this.t('CANCEL_MESSAGE'));
- this.emit(':responseReady');
- },
- 'Unhandled': function () {
- const speechOutput = this.t('HELP_UNHANDLED');
- this.response.speak(speechOutput).listen(speechOutput);
- this.emit(':responseReady');
- },
- 'SessionEndedRequest': function () {
- console.log(`Session ended in help state: ${this.event.request.reason}`);
- },
-});
-
-exports.handler = function (event, context) {
- const alexa = Alexa.handler(event, context);
- alexa.appId = APP_ID;
- // To enable string internationalization (i18n) features, set a resources object.
- alexa.resources = languageString;
- alexa.registerHandlers(newSessionHandlers, startStateHandlers, triviaStateHandlers, helpStateHandlers);
- alexa.execute();
+const NoIntent = {
+ canHandle(handlerInput) {
+ return handlerInput.requestEnvelope.request.type === 'IntentRequest'
+ && handlerInput.requestEnvelope.request.intent.name === 'AMAZON.NoIntent';
+ },
+ handle(handlerInput) {
+ const requestAttributes = handlerInput.attributesManager.getRequestAttributes();
+ const speechOutput = requestAttributes.t('NO_MESSAGE');
+ return handlerInput.responseBuilder.speak(speechOutput).getResponse();
+ },
+};
+
+const ErrorHandler = {
+ canHandle() {
+ return true;
+ },
+ handle(handlerInput, error) {
+ console.log(`Error handled: ${error.message}`);
+
+ return handlerInput.responseBuilder
+ .speak('Sorry, I can\'t understand the command. Please say again.')
+ .reprompt('Sorry, I can\'t understand the command. Please say again.')
+ .getResponse();
+ },
};
+
+const skillBuilder = Alexa.SkillBuilders.custom();
+exports.handler = skillBuilder
+ .addRequestHandlers(
+ LaunchRequest,
+ HelpIntent,
+ AnswerIntent,
+ RepeatIntent,
+ YesIntent,
+ StopIntent,
+ CancelIntent,
+ NoIntent,
+ SessionEndedRequest,
+ UnhandledIntent
+ )
+ .addRequestInterceptors(LocalizationInterceptor)
+ .addErrorHandlers(ErrorHandler)
+ .lambda();
diff --git a/lambda/custom/package.json b/lambda/custom/package.json
index 5afaa4f..b55157d 100644
--- a/lambda/custom/package.json
+++ b/lambda/custom/package.json
@@ -1,19 +1,17 @@
{
- "name": "skill-sample-js-trivia",
+ "name": "trivia",
"version": "1.0.0",
- "description": "A simple trivia skill i18n version.",
+ "description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
- "keywords": [
- "alexa",
- "skill",
- "trivia"
- ],
- "author": "Amazon.com",
- "license": "Apache-2.0",
+ "author": "",
+ "license": "ISC",
"dependencies": {
- "alexa-sdk": "^1.0.12"
+ "ask-sdk-core": "^2.0.0",
+ "ask-sdk-model": "^1.0.0",
+ "i18next": "^10.6.0",
+ "i18next-sprintf-postprocessor": "^0.2.2"
}
}
diff --git a/lambda/custom/question.js b/lambda/custom/question.js
deleted file mode 100644
index 152919b..0000000
--- a/lambda/custom/question.js
+++ /dev/null
@@ -1,755 +0,0 @@
-'use strict';
-
-module.exports = {
- /**
- * When editing your questions pay attention to your punctuation. Make sure you use question marks or periods.
- * Make sure the first answer is the correct one. Set at least ANSWER_COUNT answers, any extras will be shuffled in.
- */
- QUESTIONS_EN_GB: [
- {
- 'Reindeer have very thick coats, how many hairs per square inch do they have?': [
- '13,000',
- '1,200',
- '5,000',
- '700',
- '1,000',
- '120,000',
- ],
- },
- {
- 'The 1964 classic Rudolph The Red Nosed Reindeer was filmed in. ': [
- 'Japan',
- 'United States',
- 'Finland',
- 'Germany',
- 'Canada',
- 'Norway',
- 'France',
- ],
- },
- {
- 'Santas reindeer are cared for by one of the Christmas elves, what is his name?': [
- 'Wunorse Openslae',
- 'Alabaster Snowball',
- 'Bushy Evergreen',
- 'Pepper Minstix',
- ],
- },
- {
- 'If all of Santas reindeer had antlers while pulling his Christmas sleigh, they would all be. ': [
- 'Girls',
- 'Boys',
- 'Girls and boys',
- 'No way to tell',
- ],
- },
- {
- 'What do Reindeer eat?': [
- 'Lichen',
- 'Grasses',
- 'Leaves',
- 'Berries',
- ],
- },
- {
- 'What of the following is not true?': [
- 'Caribou live on all continents',
- 'Both reindeer and Caribou are the same species',
- 'Caribou are bigger than reindeer',
- 'Reindeer live in Scandinavia and Russia',
- ],
- },
- {
- 'In what year did Rudolph make his television debut?': [
- '1964',
- '1979',
- '2000',
- '1956',
- ],
- },
- {
- 'Who was the voice of Rudolph in the 1964 classic?': [
- 'Billie Mae Richards',
- 'Burl Ives',
- 'Paul Soles',
- 'Lady Gaga',
- ],
- },
- {
- 'In 1939 what retailer used the story of Rudolph the Red Nose Reindeer?': [
- 'Montgomery Ward',
- 'Sears',
- 'Macys',
- 'Kmart',
- ],
- },
- {
- 'Santa\'s reindeer named Donner was originally named what?': [
- 'Dunder',
- 'Donny',
- 'Dweedle',
- 'Dreamy',
- ],
- },
- {
- 'Who invented the story of Rudolph?': [
- 'Robert May',
- 'Johnny Marks',
- 'Santa',
- 'J.K. Rowling',
- ],
- },
- {
- 'In what location will you not find reindeer?': [
- 'North Pole',
- 'Lapland',
- 'Korvatunturi mountain',
- 'Finland',
- ],
- },
- {
- 'What Makes Santa\'s Reindeer Fly?': [
- 'Magical Reindeer Dust',
- 'Fusion',
- 'Amanita muscaria',
- 'Elves',
- ],
- },
- {
- 'Including Rudolph, how many reindeer hooves are there?': [
- '36',
- '24',
- '16',
- '8',
- ],
- },
- {
- 'Santa only has one female reindeer. Which one is it?': [
- 'Vixen',
- 'Clarice',
- 'Cupid',
- 'Cupid',
- ],
- },
- {
- 'In the 1964 classic Rudolph The Red Nosed Reindeer, what was the snowman narrators name?': [
- 'Sam',
- 'Frosty',
- 'Burl',
- 'Snowy',
- ],
- },
- {
- 'What was Rudolph\'s father\'s name?': [
- 'Donner',
- 'Dasher',
- 'Blixen',
- 'Comet',
- ],
- },
- {
- 'In the 1964 movie, What was the name of the coach of the Reindeer Games?': [
- 'Comet',
- 'Blixen',
- 'Donner',
- 'Dasher',
- ],
- },
- {
- 'In the 1964 movie, what is the name of the deer that Rudolph befriends at the reindeer games?': [
- 'Fireball',
- 'Clarice',
- 'Jumper',
- 'Vixen',
- ],
- },
- {
- 'In the 1964 movie, How did Donner, Rudolph\'s father, try to hide Rudolph\'s nose?': [
- 'Black mud',
- 'Bag',
- 'Pillow case',
- 'Sock',
- ],
- },
- {
- 'In the 1964 movie, what does the Misfit Elf want to be instead of a Santa Elf?': [
- 'Dentist',
- 'Reindeer',
- 'Toy maker',
- 'Candlestick maker',
- ],
- },
- {
- 'In the 1964 movie,what was the Bumble\'s one weakness?': [
- 'Could not swim',
- 'Always hungry',
- 'Candy canes',
- 'Cross eyed',
- ],
- },
- {
- 'In the 1964 movie, what is Yukon Cornelius really in search of?': [
- 'Peppermint',
- 'Gold',
- 'India',
- 'Polar Bears',
- ],
- },
- {
- 'In the 1964 movie, why is the train on the Island of Misfit Toys?': [
- 'Square wheels',
- 'No Engine',
- 'Paint does not match',
- 'It does not toot',
- ],
- },
- {
- 'In the 1964 movie, what is the name of the Jack in the Box?': [
- 'Charlie',
- 'Sam',
- 'Billy',
- 'Jack',
- ],
- },
- {
- 'In the 1964 movie, why did Santa Claus almost cancel Christmas?': [
- 'Storm',
- 'No snow',
- 'No toys',
- 'The Reindeer were sick',
- ],
- },
- {
- 'In the 1964 movie, what animal noise did the elf make to distract the Bumble?': [
- 'Oink',
- 'Growl',
- 'Bark',
- 'Meow',
- ],
- },
- {
- 'In the 1964 movie, what is the name of the prospector?': [
- 'Yukon Cornelius',
- 'Slider Sam',
- 'Bumble',
- 'Jack',
- ],
- },
- {
- 'How far do reindeer travel when they migrate?': [
- '3000 miles',
- '700 miles',
- '500 miles',
- '0 miles',
- ],
- },
- {
- 'How fast can a reindeer run?': [
- '48 miles per hour',
- '17 miles per hour',
- '19 miles per hour',
- '14 miles per hour',
- '52 miles per hour',
- '41 miles per hour',
- ],
- },
- ],
- QUESTIONS_EN_US: [
- {
- 'Reindeer have very thick coats, how many hairs per square inch do they have?': [
- '13,000',
- '1,200',
- '5,000',
- '700',
- '1,000',
- '120,000',
- ],
- },
- {
- 'The 1964 classic Rudolph The Red Nosed Reindeer was filmed in. ': [
- 'Japan',
- 'United States',
- 'Finland',
- 'Germany',
- 'Canada',
- 'Norway',
- 'France',
- ],
- },
- {
- 'Santas reindeer are cared for by one of the Christmas elves, what is his name?': [
- 'Wunorse Openslae',
- 'Alabaster Snowball',
- 'Bushy Evergreen',
- 'Pepper Minstix',
- ],
- },
- {
- 'If all of Santas reindeer had antlers while pulling his Christmas sleigh, they would all be': [
- 'Girls',
- 'Boys',
- 'Girls and boys',
- 'No way to tell',
- ],
- },
- {
- 'What do Reindeer eat?': [
- 'Lichen',
- 'Grasses',
- 'Leaves',
- 'Berries',
- ],
- },
- {
- 'What of the following is not true?': [
- 'Caribou live on all continents',
- 'Both reindeer and Caribou are the same species',
- 'Caribou are bigger than reindeer',
- 'Reindeer live in Scandinavia and Russia',
- ],
- },
- {
- 'In what year did Rudolph make his television debut?': [
- '1964',
- '1979',
- '2000',
- '1956',
- ],
- },
- {
- 'Who was the voice of Rudolph in the 1964 classic?': [
- 'Billie Mae Richards',
- 'Burl Ives',
- 'Paul Soles',
- 'Lady Gaga',
- ],
- },
- {
- 'In 1939 what retailer used the story of Rudolph the Red Nose Reindeer?': [
- 'Montgomery Ward',
- 'Sears',
- 'Macys',
- 'Kmart',
- ],
- },
- {
- 'Santa\'s reindeer named Donner was originally named what?': [
- 'Dunder',
- 'Donny',
- 'Dweedle',
- 'Dreamy',
- ],
- },
- {
- 'Who invented the story of Rudolph?': [
- 'Robert May',
- 'Johnny Marks',
- 'Santa',
- 'J.K. Rowling',
- ],
- },
- {
- 'In what location will you not find reindeer?': [
- 'North Pole',
- 'Lapland',
- 'Korvatunturi mountain',
- 'Finland',
- ],
- },
- {
- 'What Makes Santa\'s Reindeer Fly?': [
- 'Magical Reindeer Dust',
- 'Fusion',
- 'Amanita muscaria',
- 'Elves',
- ],
- },
- {
- 'Including Rudolph, how many reindeer hooves are there?': [
- '36',
- '24',
- '16',
- '8',
- ],
- },
- {
- 'Santa only has one female reindeer. Which one is it?': [
- 'Vixen',
- 'Clarice',
- 'Cupid',
- 'Cupid',
- ],
- },
- {
- 'In the 1964 classic Rudolph The Red Nosed Reindeer, what was the snowman narrators name?': [
- 'Sam',
- 'Frosty',
- 'Burl',
- 'Snowy',
- ],
- },
- {
- 'What was Rudolph\'s father\'s name?': [
- 'Donner',
- 'Dasher',
- 'Blixen',
- 'Comet',
- ],
- },
- {
- 'In the 1964 movie, What was the name of the coach of the Reindeer Games?': [
- 'Comet',
- 'Blixen',
- 'Donner',
- 'Dasher',
- ],
- },
- {
- 'In the 1964 movie, what is the name of the deer that Rudolph befriends at the reindeer games?': [
- 'Fireball',
- 'Clarice',
- 'Jumper',
- 'Vixen',
- ],
- },
- {
- 'In the 1964 movie, How did Donner, Rudolph\'s father, try to hide Rudolph\'s nose?': [
- 'Black mud',
- 'Bag',
- 'Pillow case',
- 'Sock',
- ],
- },
- {
- 'In the 1964 movie, what does the Misfit Elf want to be instead of a Santa Elf?': [
- 'Dentist',
- 'Reindeer',
- 'Toy maker',
- 'Candlestick maker',
- ],
- },
- {
- 'In the 1964 movie,what was the Bumble\'s one weakness?': [
- 'Could not swim',
- 'Always hungry',
- 'Candy canes',
- 'Cross eyed',
- ],
- },
- {
- 'In the 1964 movie, what is Yukon Cornelius really in search of?': [
- 'Peppermint',
- 'Gold',
- 'India',
- 'Polar Bears',
- ],
- },
- {
- 'In the 1964 movie, why is the train on the Island of Misfit Toys?': [
- 'Square wheels',
- 'No Engine',
- 'Paint does not match',
- 'It does not toot',
- ],
- },
- {
- 'In the 1964 movie, what is the name of the Jack in the Box?': [
- 'Charlie',
- 'Sam',
- 'Billy',
- 'Jack',
- ],
- },
- {
- 'In the 1964 movie, why did Santa Claus almost cancel Christmas?': [
- 'Storm',
- 'No snow',
- 'No toys',
- 'The Reindeer were sick',
- ],
- },
- {
- 'In the 1964 movie, what animal noise did the elf make to distract the Bumble?': [
- 'Oink',
- 'Growl',
- 'Bark',
- 'Meow',
- ],
- },
- {
- 'In the 1964 movie, what is the name of the prospector?': [
- 'Yukon Cornelius',
- 'Slider Sam',
- 'Bumble',
- 'Jack',
- ],
- },
- {
- 'How far do reindeer travel when they migrate?': [
- '3000 miles',
- '700 miles',
- '500 miles',
- '0 miles',
- ],
- },
- {
- 'How fast can a reindeer run?': [
- '48 miles per hour',
- '17 miles per hour',
- '19 miles per hour',
- '14 miles per hour',
- '52 miles per hour',
- '41 miles per hour',
- ],
- },
- ],
- QUESTIONS_DE_DE: [
- {
- 'Rentiere haben ein sehr dickes Fell. Wie viele Haare pro Quadratzentimeter haben sie?': [
- '13,000',
- '1,200',
- '5,000',
- '700',
- '1,000',
- '120,000',
- ],
- },
- {
- 'Der Klassiker aus dem Jahr 1964, Rudolph mit der roten Nase, wurde gedreht in. ': [
- 'Japan',
- 'USA',
- 'Finnland',
- 'Deutschland',
- 'Kanada',
- 'Norwegen',
- 'Frankreich',
- ],
- },
- {
- 'Um die Rentiere des Weihnachtsmanns kümmert sich eine der Weihnachtselfen. Wie heißt sie?': [
- 'Wunorse Openslae',
- 'Alabaster Snowball',
- 'Bushy Evergreen',
- 'Pfeffer Minstix',
- ],
- },
- {
- 'Wenn alle Rentiere des Weihnachtsmanns Geweihe hätten, während sie seinen Weihnachtsschlitten ziehen, wären sie alle. ': [
- 'Weiblich',
- 'Männlich',
- 'Weiblich und männlich',
- 'Kann man nicht sagen',
- ],
- },
- {
- 'Was essen Rentiere?': [
- 'Flechten',
- 'Gras',
- 'Blätter',
- 'Beeren',
- ],
- },
- {
- 'Welche Aussage ist nicht richtig?': [
- 'Karibus leben auf allen Kontinenten',
- 'Karibus und Rentiere gehören derselben Gattung an ',
- 'Karibus sind größer als Rentiere',
- 'Rentiere leben in Skandinavien und Russland',
- ],
- },
- {
- 'In welchem Jahr kam Rudolph ins Fernsehen?': [
- '1964',
- '1979',
- '2000',
- '1956',
- ],
- },
- {
- 'Wer war der Sprecher für Rudolph im klassischen Film aus dem Jahr 1964?': [
- 'Billie Mae Richards',
- 'Burl Ives',
- 'Paul Soles',
- 'Lady Gaga',
- ],
- },
- {
- 'Welche Handelskette verwendete 1939 die Geschichte von Rudolph mit der roten Nase?': [
- 'Montgomery Ward',
- 'Sears',
- 'Macys',
- 'Kmart',
- ],
- },
- {
- 'Wie hieß das Rentier des Weihnachtsmanns namens Donner ursprünglich?': [
- 'Dunder',
- 'Donny',
- 'Dweedle',
- 'Dreamy',
- ],
- },
- {
- 'Wer hat die Geschichte von Rudolph erfunden?': [
- 'Robert May',
- 'Johnny Marks',
- 'Santa',
- 'J.K. Rowling',
- ],
- },
- {
- 'Wo findest du keine Rentiere?': [
- 'Nordpol',
- 'Lappland',
- 'Korvatunturi-Berge',
- 'Finnland',
- ],
- },
- {
- 'Warum können die Rentiere des Weihnachtsmanns fliegen?': [
- 'Magischer Staub der Rentiere',
- 'Fusion',
- 'Amanita muscaria',
- 'Elfen',
- ],
- },
- {
- 'Wieviele Rentierhufe gibt es hier einschließlich Rudolph?': [
- '36',
- '24',
- '16',
- '8',
- ],
- },
- {
- 'Der Weihnachtsmann hat nur ein weibliches Rentier. Wie heißt es?': [
- 'Blitzen',
- 'Clarice',
- 'Cupid',
- 'Cupid',
- ],
- },
- {
- 'Wie war der Name des erzählenden Schneemanns im klassischen Film Rudolph mit der roten Nase aus dem Jahr 1964?': [
- 'Sam',
- 'Frosty',
- 'Burl',
- 'Snowy',
- ],
- },
- {
- 'Wie hieß der Vater von Rudolph?': [
- 'Donner',
- 'Dasher',
- 'Blixen',
- 'Comet',
- ],
- },
- {
- 'Wie war der Name des Trainers der Rentierspiele im klassischen Film aus dem Jahr 1964?': [
- 'Comet',
- 'Blixen',
- 'Donner',
- 'Dasher',
- ],
- },
- {
- 'Wie war im klassichen Film aus 1964 der Name des Hirsches, mit dem sich Rudolph befreundete?': [
- 'Fireball',
- 'Clarice',
- 'Jumper',
- 'Vixen',
- ],
- },
- {
- 'Wie hat der Vater von Rudolph, Donner, im Film aus dem Jahr 1964 versucht, die Nase von Rudolph zu verbergen?': [
- 'Schwarzer Schlamm',
- 'Sack',
- 'Kissenbezug',
- 'Socke',
- ],
- },
- {
- 'Was möchte die Misfit-Elfe im Film aus dem Jahr 1964 werden anstatt eine Elfe für den Weihnachtsmann?': [
- 'Zahnarzt',
- 'Rentier',
- 'Spielzeugmacher',
- 'Kerzenmacher',
- ],
- },
- {
- 'Was war die einzige Schwäche von Bumble im Film aus dem Jahr 1964?': [
- 'Konnte nicht schwimmen',
- 'War immer hungrig',
- 'Zuckerstangen',
- 'Schielte',
- ],
- },
- {
- 'Was sucht Yukon Cornelius in Wirklichkeit im Film aus dem Jahr 1964?': [
- 'Pfefferminz',
- 'Gold',
- 'Indien',
- 'Polarbären',
- ],
- },
- {
- 'Warum befindet sich der Zug im Film aus dem Jahr 1964 auf der Insel des fehlerhaften Spielzeugs?': [
- 'Viereckige Räder',
- 'Keine Dampfmaschine',
- 'Farbe stimmt nicht',
- 'Pfeift nicht',
- ],
- },
- {
- 'Wie lautet der Name des Schachtelmännchens im Film aus dem Jahr 1964?': [
- 'Charlie',
- 'Sam',
- 'Billy',
- 'Jack',
- ],
- },
- {
- 'Warum hat der Weihnachtsmann im Film aus dem Jahr 1964 Weihnachten beinahe abgesagt?': [
- 'Sturm',
- 'Kein Schnee',
- 'Kein Spielzeug',
- 'Die Rentiere waren krank',
- ],
- },
- {
- 'Welches tierische Geräusch machte die Elfe im Film aus dem Jahr 1964, um den Bumble abzulenken?': [
- 'Oink',
- 'Knurr',
- 'Wauwau',
- 'Miau',
- ],
- },
- {
- 'Wie lautet der Name des Goldsuchers im Film aus dem Jahr 1964?': [
- 'Yukon Cornelius',
- 'Slider Sam',
- 'Bumble',
- 'Jack',
- ],
- },
- {
- 'Wie weit ziehen Rentiere auf ihren Wanderungen?': [
- '4800 km',
- '1100 km',
- '800 km',
- '0 km',
- ],
- },
- {
- 'Wie schnell läuft ein Rentier?': [
- '77 km pro Stunde',
- '27 km pro Stunde',
- '30 km pro Stunde',
- '22 km pro Stunde',
- '83 km pro Stunde',
- '65 km pro Stunde',
- ],
- },
- ],
-};
diff --git a/lambda/custom/questions.js b/lambda/custom/questions.js
new file mode 100644
index 0000000..674585e
--- /dev/null
+++ b/lambda/custom/questions.js
@@ -0,0 +1,506 @@
+module.exports = {
+ /**
+ * When editing your questions pay attention to your punctuation.
+ * Make sure you use question marks.
+ * Make sure the first answer is the correct one.
+ * Set at least ANSWER_COUNT answers, any extras will be shuffled in.
+ */
+ "QUESTIONS_JA_JP" : [
+ {
+ "トナカイの毛皮はとても厚いです。1平方インチあたり何本の毛が生えているでしょう?": [
+ "一万三千本",
+ "千二百本",
+ "五千本",
+ "七百本",
+ "千本",
+ "十二万本"
+ ]
+ },
+ {
+ "1964年公開の映画、赤鼻のトナカイが撮影されたのはどこ?": [
+ "日本",
+ "アメリカ",
+ "フィンランド",
+ "ドイツ",
+ "カナダ",
+ "ノルウェイ",
+ "フランス"
+ ]
+ },
+ {
+ "サンタクロースのトナカイはあるクリスマスの妖精が世話をしています。彼の名前は?": [
+ "ウォンノース・オペンスレー",
+ "アラバスター・スノーボール",
+ "ブッシー・エバーグリーン",
+ "ペッパー・ミンスティックス"
+ ]
+ },
+ {
+ "クリスマスの時期にサンタクロースのトナカイ全員にツノが生えているとすると、トナカイの性別は?": [
+ "全員メス",
+ "全員オス",
+ "オスとメスの両方",
+ "不明"
+ ]
+ },
+ {
+ "トナカイの餌は何でしょう?": [
+ "苔",
+ "草",
+ "葉っぱ",
+ "ベリー"
+ ]
+ },
+ {
+ "次のうち誤りはどれでしょう?": [
+ "カリブーは世界中の国に生息している",
+ "トナカイとカリブーは同じ種である",
+ "カリブーはトナカイよりも大きい",
+ "トナカイはスカンジナビアとロシアに生息している"
+ ]
+ },
+ {
+ "ルドルフ 赤鼻のトナカイのテレビ放映が始まったのはいつ?": [
+ "1964年",
+ "1979年",
+ "2000年",
+ "1956年"
+ ]
+ },
+ {
+ "1964年版のルドルフ 赤鼻のトナカイでルドルフの声を演じたのは誰?": [
+ "ビリー・モエ・リチャーズ",
+ "バール・アイブス",
+ "ポール・ソロス",
+ "レディ・ガガ"
+ ]
+ },
+ {
+ "1939年にルドルフ 赤鼻のトナカイを出版した会社はどこ?": [
+ "モンゴメリー・ワード",
+ "シアーズ",
+ "メイシーズ",
+ "ケイマート"
+ ]
+ },
+ {
+ "サンタのトナカイであるドネールの元々の名前は何?": [
+ "ダンダー",
+ "ドニー",
+ "ドゥエードル",
+ "ドリーミー"
+ ]
+ },
+ {
+ "ルドルフ 赤鼻のトナカイの物語を作ったのは誰?": [
+ "ロバート・メイ",
+ "ジョニー・マークス",
+ "サンタ",
+ "ジェイ・ケイ・ローリング"
+ ]
+ },
+ {
+ "トナカイがいないのはどこ?": [
+ "北極",
+ "ラップランド",
+ "コルヴァトゥントゥリ山",
+ "フィンランド"
+ ]
+ },
+ {
+ "サンタのトナカイに空を飛ぶ力を与えているのは何?": [
+ "トナカイの魔法の粉",
+ "合体",
+ "ベニテングタケ",
+ "エルフ"
+ ]
+ },
+ {
+ "トナカイの蹄の数はルドルフも含めて合計で何本?": [
+ "36本",
+ "24本",
+ "16本",
+ "8本"
+ ]
+ },
+ {
+ "サンタのトナカイには一頭だけメスがいます。名前は?": [
+ "ヴィクセン",
+ "クラリス",
+ "キューピッド",
+ "キューピッド"
+ ]
+ },
+ {
+ "1964年の映画、ルドルフ 赤鼻のトナカイでナレーターをしていた雪だるまの名前は?": [
+ "サム",
+ "フロスティ",
+ "バール",
+ "スノウィー"
+ ]
+ },
+ {
+ "ルドルフの父親の名前は?": [
+ "ドネール",
+ "ダッシャー",
+ "ブリクセン",
+ "コメット"
+ ]
+ },
+ {
+ "1964年の映画で、トナカイゲームのコーチの名前は?": [
+ "コメット",
+ "ブリクセン",
+ "ドネール",
+ "ダッシャー"
+ ]
+ },
+ {
+ "1964年の映画で、トナカイゲームでルドルフの友達になったトナカイの名前は?": [
+ "ファイヤーボール",
+ "クラリス",
+ "ジャンパー",
+ "ビクセン"
+ ]
+ },
+ {
+ "1964年の映画で、ルドルフの父親ドネールはどうやってルドルフの鼻を隠そうとした?": [
+ "黒い蕾",
+ "カバン",
+ "枕カバー",
+ "靴下"
+ ]
+ },
+ {
+ "1964年の映画で、出来損ないのエルフがサンタのエルフになる代わりになりたかったのは?": [
+ "歯医者",
+ "トナカイ",
+ "おもちゃ職人",
+ "ろうそく職人"
+ ]
+ },
+ {
+ "1964年の映画で、バンブルの唯一の弱点は何?": [
+ "泳げないこと",
+ "いつもお腹が空いていること",
+ "スティックキャンディー",
+ "斜視"
+ ]
+ },
+ {
+ "1964年の映画で、ユコン・コーネリアスが本当に探していたのは何?": [
+ "ペッパーミント",
+ "黄金",
+ "インド",
+ "シロクマ"
+ ]
+ },
+ {
+ "1964年の映画で、出来損ないのおもちゃたちの中に汽車がいた理由は?": [
+ "車輪が四角かったから",
+ "エンジンがなかったから",
+ "色がおかしかったから",
+ "汽笛がならなかったから"
+ ]
+ },
+ {
+ "1964年の映画に出てきたびっくり箱の名前は?": [
+ "チャーリー",
+ "サム",
+ "ビリー",
+ "ジャック"
+ ]
+ },
+ {
+ "1964年の映画で、サンタがクリスマスを中止しそうになった原因は?": [
+ "嵐がきたから",
+ "雪がなかったから",
+ "おもちゃがなかったから",
+ "トナカイが病気になったから"
+ ]
+ },
+ {
+ "1964年の映画で、エルフがバンブルの気をそらすために使った動物の鳴き声は?": [
+ "ブーブー",
+ "ウー",
+ "ワンワン",
+ "ニャー"
+ ]
+ },
+ {
+ "1964年の映画で、採掘をしていた人の名前は?": [
+ "ユコン・コーネリアス",
+ "スライダー・サム",
+ "バンブル",
+ "ジャック"
+ ]
+ },
+ {
+ "トナカイは移住のときどのくらい移動する?": [
+ "3000マイル",
+ "700マイル",
+ "500マイル",
+ "0マイル"
+ ]
+ },
+ {
+ "トナカイの走る速さは?": [
+ "時速48マイル",
+ "時速17マイル",
+ "時速19マイル",
+ "時速14マイル",
+ "時速52マイル",
+ "時速41マイル"
+ ]
+ }
+ ],
+ "QUESTIONS_EN_US" : [
+ {
+ "Reindeer have very thick coats, how many hairs per square inch do they have?": [
+ "13,000",
+ "1,200",
+ "5,000",
+ "700",
+ "1,000",
+ "120,000"
+ ]
+ },
+ {
+ "The 1964 classic Rudolph The Red Nosed Reindeer was filmed in. ": [
+ "Japan",
+ "United States",
+ "Finland",
+ "Germany",
+ "Canada",
+ "Norway",
+ "France"
+ ]
+ },
+ {
+ "Santas reindeer are cared for by one of the Christmas elves, what is his name?": [
+ "Wunorse Openslae",
+ "Alabaster Snowball",
+ "Bushy Evergreen",
+ "Pepper Minstix"
+ ]
+ },
+ {
+ "If all of Santas reindeer had antlers while pulling his Christmas sleigh, they would all be": [
+ "Girls",
+ "Boys",
+ "Girls and boys",
+ "No way to tell"
+ ]
+ },
+ {
+ "What do Reindeer eat?": [
+ "Lichen",
+ "Grasses",
+ "Leaves",
+ "Berries"
+ ]
+ },
+ {
+ "What of the following is not true?": [
+ "Caribou live on all continents",
+ "Both reindeer and Caribou are the same species",
+ "Caribou are bigger than reindeer",
+ "Reindeer live in Scandinavia and Russia"
+ ]
+ },
+ {
+ "In what year did Rudolph make his television debut?": [
+ "1964",
+ "1979",
+ "2000",
+ "1956"
+ ]
+ },
+ {
+ "Who was the voice of Rudolph in the 1964 classic?": [
+ "Billie Mae Richards",
+ "Burl Ives",
+ "Paul Soles",
+ "Lady Gaga"
+ ]
+ },
+ {
+ "In 1939 what retailer used the story of Rudolph the Red Nose Reindeer?": [
+ "Montgomery Ward",
+ "Sears",
+ "Macys",
+ "Kmart"
+ ]
+ },
+ {
+ "Santa\'s reindeer named Donner was originally named what?": [
+ "Dunder",
+ "Donny",
+ "Dweedle",
+ "Dreamy"
+ ]
+ },
+ {
+ "Who invented the story of Rudolph?": [
+ "Robert May",
+ "Johnny Marks",
+ "Santa",
+ "J.K. Rowling"
+ ]
+ },
+ {
+ "In what location will you not find reindeer?": [
+ "North Pole",
+ "Lapland",
+ "Korvatunturi mountain",
+ "Finland"
+ ]
+ },
+ {
+ "What Makes Santa\'s Reindeer Fly?": [
+ "Magical Reindeer Dust",
+ "Fusion",
+ "Amanita muscaria",
+ "Elves"
+ ]
+ },
+ {
+ "Including Rudolph, how many reindeer hooves are there?": [
+ "36",
+ "24",
+ "16",
+ "8"
+ ]
+ },
+ {
+ "Santa only has one female reindeer. Which one is it?": [
+ "Vixen",
+ "Clarice",
+ "Cupid",
+ "Cupid"
+ ]
+ },
+ {
+ "In the 1964 classic Rudolph The Red Nosed Reindeer, what was the snowman narrators name?": [
+ "Sam",
+ "Frosty",
+ "Burl",
+ "Snowy"
+ ]
+ },
+ {
+ "What was Rudolph\'s father\'s name?": [
+ "Donner",
+ "Dasher",
+ "Blixen",
+ "Comet"
+ ]
+ },
+ {
+ "In the 1964 movie, What was the name of the coach of the Reindeer Games?": [
+ "Comet",
+ "Blixen",
+ "Donner",
+ "Dasher"
+ ]
+ },
+ {
+ "In the 1964 movie, what is the name of the deer that Rudolph befriends at the reindeer games?": [
+ "Fireball",
+ "Clarice",
+ "Jumper",
+ "Vixen"
+ ]
+ },
+ {
+ "In the 1964 movie, How did Donner, Rudolph\'s father, try to hide Rudolph\'s nose?": [
+ "Black mud",
+ "Bag",
+ "Pillow case",
+ "Sock"
+ ]
+ },
+ {
+ "In the 1964 movie, what does the Misfit Elf want to be instead of a Santa Elf?": [
+ "Dentist",
+ "Reindeer",
+ "Toy maker",
+ "Candlestick maker"
+ ]
+ },
+ {
+ "In the 1964 movie,what was the Bumble\'s one weakness?": [
+ "Could not swim",
+ "Always hungry",
+ "Candy canes",
+ "Cross eyed"
+ ]
+ },
+ {
+ "In the 1964 movie, what is Yukon Cornelius really in search of?": [
+ "Peppermint",
+ "Gold",
+ "India",
+ "Polar Bears"
+ ]
+ },
+ {
+ "In the 1964 movie, why is the train on the Island of Misfit Toys?": [
+ "Square wheels",
+ "No Engine",
+ "Paint does not match",
+ "It does not toot"
+ ]
+ },
+ {
+ "In the 1964 movie, what is the name of the Jack in the Box?": [
+ "Charlie",
+ "Sam",
+ "Billy",
+ "Jack"
+ ]
+ },
+ {
+ "In the 1964 movie, why did Santa Claus almost cancel Christmas?": [
+ "Storm",
+ "No snow",
+ "No toys",
+ "The Reindeer were sick"
+ ]
+ },
+ {
+ "In the 1964 movie, what animal noise did the elf make to distract the Bumble?": [
+ "Oink",
+ "Growl",
+ "Bark",
+ "Meow"
+ ]
+ },
+ {
+ "In the 1964 movie, what is the name of the prospector?": [
+ "Yukon Cornelius",
+ "Slider Sam",
+ "Bumble",
+ "Jack"
+ ]
+ },
+ {
+ "How far do reindeer travel when they migrate?": [
+ "3000 miles",
+ "700 miles",
+ "500 miles",
+ "0 miles"
+ ]
+ },
+ {
+ "How fast can a reindeer run?": [
+ "48 miles per hour",
+ "17 miles per hour",
+ "19 miles per hour",
+ "14 miles per hour",
+ "52 miles per hour",
+ "41 miles per hour"
+ ]
+ }
+ ]
+};
diff --git a/models/de-DE.json b/models/de-DE.json
deleted file mode 100644
index a7fcdcb..0000000
--- a/models/de-DE.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "interactionModel": {
- "languageModel": {
- "invocationName": "spiel",
- "intents": [
- {
- "name": "AnswerIntent",
- "slots": [
- {
- "name": "Answer",
- "type": "AMAZON.NUMBER"
- }
- ],
- "samples": [
- "die Antwort ist {Answer}",
- "meine Antwort ist {Answer}",
- "ist die Antwort {Answer}",
- "{Answer} ist meine Antwort",
- "{Answer}"
- ]
- },
- {
- "name": "DontKnowIntent",
- "samples": [
- "weiß ich nicht",
- "weiß nicht",
- "überspringen",
- "das weiß ich nicht",
- "wer weiß",
- "diese Frage weiß ich nicht",
- "die weiß ich nicht",
- "keine Ahnung"
- ]
- },
- {
- "name": "AMAZON.StartOverIntent",
- "samples": [
- "Spiel starten",
- "neues Spiel",
- "starten",
- "neues Spiel starten"
- ]
- },
- {
- "name": "AMAZON.RepeatIntent"
- },
- {
- "name": "AMAZON.HelpIntent"
- },
- {
- "name": "AMAZON.YesIntent"
- },
- {
- "name": "AMAZON.NoIntent"
- },
- {
- "name": "AMAZON.StopIntent"
- },
- {
- "name": "AMAZON.CancelIntent"
- }
- ]
- }
- }
-}
diff --git a/models/en-GB.json b/models/en-GB.json
deleted file mode 100644
index 59e5bc9..0000000
--- a/models/en-GB.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "interactionModel": {
- "languageModel": {
- "invocationName": "game",
- "intents": [
- {
- "name": "AnswerIntent",
- "slots": [
- {
- "name": "Answer",
- "type": "AMAZON.NUMBER"
- }
- ],
- "samples": [
- "the answer is {Answer}",
- "my answer is {Answer}",
- "is it {Answer}",
- "{Answer} is my answer",
- "{Answer}"
- ]
- },
- {
- "name": "DontKnowIntent",
- "samples": [
- "i don't know",
- "don't know",
- "skip",
- "i don't know that",
- "who knows",
- "i don't know this question",
- "i don't know that one",
- "dunno"
- ]
- },
- {
- "name": "AMAZON.StartOverIntent",
- "samples": [
- "start game",
- "new game",
- "start",
- "start new game"
- ]
- },
- {
- "name": "AMAZON.RepeatIntent"
- },
- {
- "name": "AMAZON.HelpIntent"
- },
- {
- "name": "AMAZON.YesIntent"
- },
- {
- "name": "AMAZON.NoIntent"
- },
- {
- "name": "AMAZON.StopIntent"
- },
- {
- "name": "AMAZON.CancelIntent"
- }
- ]
- }
- }
-}
diff --git a/models/ja-JP.json b/models/ja-JP.json
new file mode 100644
index 0000000..991218f
--- /dev/null
+++ b/models/ja-JP.json
@@ -0,0 +1,72 @@
+{
+ "interactionModel": {
+ "languageModel": {
+ "invocationName": "トナカイトリビア",
+ "intents": [
+ {
+ "name": "AMAZON.CancelIntent",
+ "samples": []
+ },
+ {
+ "name": "AMAZON.HelpIntent",
+ "samples": []
+ },
+ {
+ "name": "AMAZON.StopIntent",
+ "samples": []
+ },
+ {
+ "name": "AnswerIntent",
+ "samples": [
+ "{Answer} です",
+ "答えは {Answer}",
+ "{Answer} かな",
+ "{Answer} だと思う",
+ "{Answer}"
+ ],
+ "slots": [
+ {
+ "name": "Answer",
+ "type": "AMAZON.NUMBER",
+ "samples": []
+ }
+ ]
+ },
+ {
+ "name": "DontKnowIntent",
+ "samples": [
+ "わかりません",
+ "わからない",
+ "知らない",
+ "わかんない",
+ "スキップ",
+ "知りません",
+ "知らん",
+ "意味わかんない"
+ ],
+ "slots": []
+ },
+ {
+ "name": "AMAZON.StartOverIntent",
+ "samples": [
+ "ゲーム開始",
+ "新しいゲーム",
+ "開始",
+ "新しいゲームを開始",
+ "やりなおし",
+ "もう一回"
+ ]
+ },
+ {
+ "name": "AMAZON.RepeatIntent"
+ },
+ {
+ "name": "AMAZON.YesIntent"
+ },
+ {
+ "name": "AMAZON.NoIntent"
+ }
+ ]
+ }
+ }
+}
diff --git a/skill.json b/skill.json
index 240cd7c..188aab7 100644
--- a/skill.json
+++ b/skill.json
@@ -1,21 +1,21 @@
{
- "skillManifest": {
+ "manifest": {
"publishingInformation": {
"locales": {
- "en-US": {
- "summary": "Sample Short Description",
+ "ja-JP": {
+ "summary": "サンプルの概略",
"examplePhrases": [
- "Alexa open reindeer trivia",
- "Alexa tell reindeer trivia to start a game",
- "Alexa tell reindeer trivia I want to play"
+ "アレクサ、トナカイトレビアを開いて",
+ "アレクサ、トナカイトレビアでゲームをしよう",
+ "アレクサ、トナカイトレビアで遊びたい"
],
- "name": "trivia",
- "description": "Sample Full Description"
+ "name": "トナカイトレビア",
+ "description": "サンプルの説明"
}
},
"isAvailableWorldwide": true,
- "testingInstructions": "Sample Testing Instructions.",
- "category": "TRIVIA",
+ "testingInstructions": "テスト方法の説明",
+ "category": "EDUCATION_AND_REFERENCE",
"distributionCountries": []
},
"apis": {