對話動作已於 2023 年 6 月 13 日淘汰。詳情請參閱「
對話動作已淘汰」。
提供本地化的動作
透過集合功能整理內容
你可以依據偏好儲存及分類內容。
由於 Actions 提供對話式介面,因此將 Actions 專案本地化時,需要考量的因素比一般開發專案更多。動作的許多元件都需要翻譯,包括設定、資源、意圖、類型和提示。
動作的部分元件需要特別留意,以確保對話介面能夠以譯文語言運作。舉例來說,用於叫用意圖的訓練詞組應諮詢譯文語言的母語人士,而不是只將以預設語言建立的詞組翻譯成目標語言。
Actions Builder 和 Actions SDK 都支援動作本地化。將動作專案本地化時,需要本地化的兩組不同的實體:專案設定/資源和對話元件。
專案設定與資源
專案設定包含使用者在動作的目錄清單中所找到的資訊,例如動作功能的簡短說明。
資源是需要本地化的圖片、音訊檔案和其他專案字串,例如標誌圖片或在提示中使用的錄製音訊。
將專案的設定和資源本地化,只是將設定/資源的翻譯版本從原始語言代碼提供給新語言代碼的做法。
對話元件
將對話元件本地化與提供現有內容翻譯不同。將其他語言代碼的對話本地化,主要目的是提供自然直覺的對話體驗;這種概念會因語言代碼的具體背景資訊及其演進方式而異。
以下各節討論在動作專案中本地化意圖、類型和提示時應注意的事項。
意圖
意圖會表達使用者的意願,或要求動作能執行的操作。您在意圖中提供的訓練詞組可協助 Google 助理的自然語言理解 (NLU) 判斷哪些動作的意圖符合使用者的要求。
為意圖將訓練詞組本地化時,不應只翻譯現有詞組,應考量意圖的意義,並定義能夠更準確地以譯文語言表達潛在使用者要求的訓練詞組。語言表達方式取決於當地情境對語言演進的影響,以及可用於定義概念的運算式範圍。
舉例來說,在對話過程中,您可以請使用者找出幸運的物品。巴西的房間角落
可能加了一桶鹽日本有一大早就看到蜘蛛的使用者
是幸運的在中國,如果使用者看到數字 8 或紅色,他們可能會認為這是個幸運的。
類型
類型可用來定義商業邏輯需要處理的實體。例如:使用者訂購項目的選項和修改項目。類型值的同義詞可讓 Google 助理 NLU 更有效地從使用者說的話中擷取資訊。即使是簡單的 yes
類型值,也應該包含 yeah
或 okay
等同義詞,因為使用者可能會使用不同的字詞來確認。
本地化類型值的同義詞時,請務必考量不同語言的同義詞數量,會因當地語言和文化的演化等因素而異。
有助於釐清這個問題的一個例子,就是雪景的概念。英文有幾根雪的字,包括水彩、暴風雪、草皮和粉末。相反地,北歐地區說的薩米語言系列擁有超過 100 個語句,
將假設類型 (例如雪) 本地化時,應考量以下兩個重點:
- 多種字詞:在對話中,Sámi 的講者應會預期收到雪的表達方式比英文使用者更多。
- 字詞特殊化:某些語言的可用運算式可能太過精確,因此在對話體驗中可能很實用。例如,那假設 guoldu 是一個字,也就是「有硬度霜但非常風大的雪雲會從地上發動。」雖然從技術上來說,這個詞彙是用來表示雪種類型,但對於 Sámi 語使用者而言,這可能並非實際用途。
提示
提示的用途是引導使用者完成與動作的對話。這會告知使用者您的動作可以執行哪些操作,並要求您提供完成要求所需的特定資訊。
將提示本地化時,請務必考量不同的語言和文化對於「良好的對話的構成條件」有不同的期望。
舉例來說,日文具有廣泛的文法系統來表達友善和正式程度,進而轉譯為以下三種主要的友善程度:kudaketa (純格式)、teinei (簡單的友善形式) 和 keigo (進階友善形式)。
選擇要使用的表單時,取決於各種因素,這些因素會決定每個個人在回答其他個人時應使用哪個正式程度。就動作的日文本地化而言,這代表有兩件事:
- 瞭解稱呼使用者時該採用哪個層級。
- 針對必要的正式程度提供本地化提示。
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-26 (世界標準時間)。
[null,null,["上次更新時間:2025-07-26 (世界標準時間)。"],[[["\u003cp\u003eLocalizing Actions involves translating various components like settings, resources, intents, types, and prompts for a natural conversational experience in the target language.\u003c/p\u003e\n"],["\u003cp\u003eWhen localizing intents and types, consider cultural nuances and linguistic variations to accurately reflect user expressions and entity synonyms in the target language.\u003c/p\u003e\n"],["\u003cp\u003ePrompts should be adapted to align with cultural expectations and conversational norms, such as levels of formality and politeness, for a seamless user experience.\u003c/p\u003e\n"],["\u003cp\u003eEffective localization goes beyond direct translation and requires understanding cultural context and language evolution to ensure the conversation feels intuitive and natural for users in different locales.\u003c/p\u003e\n"]]],["Localizing Actions requires more than simple translation; it involves adapting the conversational experience. Key actions include translating project settings and resources like descriptions and images. Conversational components like intents, types, and prompts need careful consideration of the target language's nuances. Intents require new training phrases crafted with native speaker input. Types need localized synonyms that account for the language's variety and specialization, as seen in different words for snow. Prompts must reflect the target culture's conversational expectations and formality levels.\n"],null,["Since Actions provide a conversational interface, there are more things to\nconsider when localizing an Actions project than an average development project.\nMany components of your Action require translation, including settings,\nresources, intents, types, and prompts.\n\nSome components of an Action require particular attention to ensure that the\nconversational interface works in the target language. For example, training\nphrases used to invoke intents should be created in consultation with native\nspeakers of the target language, rather than simply translating the phrases\ncreated in the default language into the target language.\n\nActions Builder and the Actions SDK both support localization of your Action.\nWhen localizing an Actions project, there are two distinct groups of entities\nthat require localization: project settings/resources and conversational\ncomponents.\n\nProject settings and resources\n\nA project's settings include the information users find in your Action's\ndirectory listing, like short and long descriptions of your Action's\nfunctionality.\n\nResources are images, audio files, and other project strings that require\nlocalization, like logo images or recorded audio used in prompts.\n\nLocalizing a project's settings and resources is just a matter of providing\ntranslated versions of the settings/resources from the original locale to the\nnew locale.\n\nConversational components\n\nLocalizing conversational components is different than just providing a\ntranslation of existing content. The main objective of localizing a conversation\nfor other locales is to provide a conversational experience that feels natural\nand intuitive; a concept that varies based on the specific context of the locale\nlanguage and its evolution.\n\nThe following sections discuss considerations for localizing intents, types, and\nprompts in your Actions project.\n\nIntents\n\nIntents express a user's desire or need that your Action can fulfill. Training\nphrases you provide in an intent help the Assistant's Natural Language\nUnderstanding (NLU) determine which of the Action's intents match what a user is\nrequesting.\n\nWhen you localize training phrases for an intent, instead of just translating\nthe existing phrases, you should consider the meaning of the intent and define\ntraining phrases that better express potential user requests in the target\nlanguage. The expressivity of languages varies based on how the local context\nhas affected the evolution of the language, and the range of expressions\navailable to define concepts.\n\nAs an example, consider a conversational interaction where you ask users to\nidentify something they consider lucky. In Brazil, this could be having a pot of\nsalt in the corner of a room. In Japan, a user who sees a spider in the morning\nis lucky. In China, a user who sees the number 8 or the color red may consider\nthemselves lucky.\n\nTypes\n\nTypes are used to define entities that your business logic needs to handle. For\nexample, options and modifications to items a user is ordering. Synonyms for\ntype values make the Assistant NLU more effective at extracting information from\nwhat a user says. Even a simple `yes` type value should have synonyms like\n`yeah` or `okay`, as a user might use a different word for affirmation.\n\nWhen localizing synonyms for type values, it's important to consider different\nlanguages can have a varying number of synonyms for the same concept, depending\non factors like the evolution of the local language and culture.\n\nAn example that helps clarify this is the concept of snow. In English, there are\na handful of words for snow, including flurry, blizzard, slush, and powder. In\ncontrast, the Sámi family of languages spoken in Northern Europe, has well over\n100 words for snow.\n\nThere are two points that you should consider when localizing a hypothetical\ntype, like snow:\n\n- **Variety of words**: In a conversation, a speaker of Sámi would expect a larger variety of options to express snow, as opposed to an English user.\n- **Specialization of words** : Some available expressions in a given language may be too specific to be useful as part of a conversational experience. For example, consider the Sámi word *guoldu*, which means \"a cloud of snow which blows up from the ground when there is a hard frost without very much wind\". While this term is technically a way to indicate a type of snow, it may not be of any practical use to a Sámi-speaking user of your Action.\n\nPrompts\n\nPrompts are used to guide users through conversations with your Action. These\ninform the user of what your Action can do, as well as ask for specific\ninformation you need to fulfill their requests.\n\nWhen localizing prompts, it's important to consider different languages and\ncultures can have different expectations about what constitutes a \"good\nconversation\".\n\nFor example, the Japanese language has an extensive grammatical system to\nexpress politeness and formality, that translates to three main politeness\nlevels: *kudaketa* (the plain form), *teinei* (the simple polite form), and\n*keigo* (the advanced polite form).\n\nChoosing which form to use depends on a variety of factors that determine which\nlevel of formality each individual should use when addressing another\nindividual. For the Japanese localization of your Action this means two things:\n\n- Understanding which level to use when addressing your users.\n- Providing localized prompts for the required level(s) of formality."]]