Backbone - Localization
 
Loading...
Searching...
No Matches
Backbone::LocalizedImage Class Reference

Automatically updates a UI Image component with a localized sprite from the LocalizationManager. More...

Inheritance diagram for Backbone::LocalizedImage:

Public Attributes

LocalizedSprite localizedSprite
 Localized sprite definition (can use a key or inline values).
 

Private Member Functions

void Awake ()
 
void OnEnable ()
 
void OnDisable ()
 
void UpdateImage ()
 Updates the Image's sprite using the localized value from the manager.
 

Private Attributes

Image imageComponent
 

Detailed Description

Automatically updates a UI Image component with a localized sprite from the LocalizationManager.

This component listens to language changes and updates the sprite of the attached Image based on a localization key. It supports runtime localization switching for UI visuals.

Usage:

  1. Attach this component to a GameObject with an Image component (Unity UI).
  2. Set the localizationKey in the Inspector to match a key defined in your localized sprite data.
  3. At runtime, when the language changes, the image will automatically be updated.

Example:

  • Suppose your localization data contains: Key: icons.warning English: warning_en.png Spanish: warning_es.png
  • In the Inspector: localizationKey = "icons.warning"
  • At runtime, the corresponding sprite will be loaded from the LocalizationManager.

Notes:

  • This component requires an Image component.
  • If the key is not found, a warning is logged and the sprite remains unchanged.

Member Function Documentation

◆ Awake()

void Backbone::LocalizedImage::Awake ( )
private

◆ OnDisable()

void Backbone::LocalizedImage::OnDisable ( )
private

◆ OnEnable()

void Backbone::LocalizedImage::OnEnable ( )
private

◆ UpdateImage()

void Backbone::LocalizedImage::UpdateImage ( )
private

Updates the Image's sprite using the localized value from the manager.

Member Data Documentation

◆ imageComponent

Image Backbone::LocalizedImage::imageComponent
private

◆ localizedSprite

LocalizedSprite Backbone::LocalizedImage::localizedSprite

Localized sprite definition (can use a key or inline values).


The documentation for this class was generated from the following file: