Forum rules - please read before posting.

Localization of use syntax

I am researching the localization options when it comes to languages that support articles like French, Spanish, German, Greek and so on. In those languages, you must perform noun declining in order for the constructed phrase to make sense: For example while in English we can just say "Use pen on paper" (maybe even "Use the pen on the paper") for:

  • French: "Utilisez le stylo sur le papier"
  • Spanish: "Usa el bolígrafo sobre el papel"
  • German: "Verwenden Sie den Stift auf dem Papier"
  • Greek: "Χρησιμοποίησε το στυλό στο χαρτί"

There are several things to note here: For example genders are not consistent from one language to another, or in some languages (like Greek) the "on" word equivalent gets merged with the article ("στο") of the item.

As far as I can understand there's no support for such smart formatting when it comes to Adventure Creator even if I choose to use the Unity Localization package as the GetHotspotPrefixLabel(...) method will not perform any string formatting when it comes to 'smart strings'.

Is my assumption correct or is there a way to make the 'Use syntax' aware of those localization "quirks"?

Comments

  • A custom script is necessary to handle the formatting based on language-specific conditions, but it's possible to override the default "Hotspot label" when e.g. a Hotspot is hovered-over while an Inventory item is selected:

    using AC;
    using UnityEngine;
    
    public class CustomHotspotLabel : MonoBehaviour
    {
    
        public string menuName = "Hotspot";
        public string elementName = "HotspotLabel";
        private MenuLabel hotspotLabel;
    
        void Start()
        {
            hotspotLabel = PlayerMenus.GetElementWithName(menuName, elementName) as MenuLabel;
        }
    
        void Update()
        {
            if (KickStarter.playerInteraction.GetActiveHotspot() && InvInstance.IsValid(KickStarter.runtimeInventory.SelectedInstance))
            {
                var languageIndex = Options.GetLanguage();
                string overrideText = ""; // Set this
                hotspotLabel.OverrideLabel(overrideText);
            }
            else
            {
                hotspotLabel.OverrideLabel(string.Empty);
            }
        }
    
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.