# Localizing Components

Localized assets must be attached to the actual game objects in the scene in order to set localized value to the appropriate component's attribute. The system offers various ready-to-use components.

### Localizing a Text Component

* While the Text game object selected, click **Add Component** button in the inspector.
* Search for **Localized Text** and add it.
* **LocalizedTextBehaviour** needs a component and it's property to set localized value to the property.
* Drag the `Text` component from the game object to the **LocalizedTextBehaviour**'s **Component** field.
* The localization system searches for the text (`string`) based properties. **Property** drop-down lists available properties. Simply select **text** property.
* Finally, select localized text asset from the **Localized Asset** field.

{% embed url="<https://gfycat.com/LeanFreshBangeltiger>" %}
Localizing Text Component
{% endembed %}

When the game starts, the localization sets the **text** property of the selected component with selected localized asset's value. Updates the value whenever game language has changed.

This generic component & property selection provides us to use at any component that has text based property. For example; we can use same behavior with same steps for the [Text Mesh Pro](https://assetstore.unity.com/packages/essentials/beta-projects/textmesh-pro-84126) component. You should follow the similar steps for all localized asset types. For instance; attach **LocalizedSpriteBehaviour** for the [Image](https://docs.unity3d.com/Manual/script-Image.html) component and select [sprite](https://docs.unity3d.com/ScriptReference/UI.Image-sprite.html) property and done!

{% embed url="<https://gfycat.com/WelcomeTastyArchaeocete>" %}
Localizing Custom Component & Property
{% endembed %}

If you want to go further and create your custom localization behavior, see [here](/gametoolkit-localization/scripting-reference.md#extending-custom-localized-asset).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://hibrahimpenekli.gitbook.io/gametoolkit-localization/localizing-components.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
