Translation (Localization)
SkillfulAPI.
Translate
SkillfulAPI.
Translate
Overview
The Translation
class provides functionality to translate text from one language to another using the SkillfulAI API. This can be useful for localizing game content, providing multilingual support, or adapting text for different audiences.
Class Definition
Detailed Explanation
Start Method
Description: Unity's Start
method is called when the script is first initialized. This method triggers the translation process.
Code:
Functionality:
Automatically invokes the
Translate
method when the script starts.Suitable for initializing translation tasks or performing actions as soon as the script is activated.
Translate Method
Description: The Translate
method sends a specified input text to the SkillfulAI API for translation from English to French and logs the result.
Code:
Functionality:
Sends the input text to the SkillfulAI API for translation.
Translates the text from English to French. You can adjust the language pair if needed.
Logs the translated text received from the API response.
Usage Example
Add the Script to a GameObject:
Attach the
Translation
script to any GameObject in your Unity scene.
Run the Scene:
Upon starting the scene, the
Translate
method will be invoked automatically.The specified input text will be sent to the SkillfulAI API, and the translated text will be logged to the console.
Conclusion
The Translation
function provides a straightforward implementation of text translation using the SkillfulAI Gaming SDK. By translating text between languages, you can easily localize content and enhance the accessibility of your Unity project.
Last updated