Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Feature Request Inspector static smart parameters

Discussion in 'Localization Tools' started by Sniperemi, Apr 21, 2021.

  1. Sniperemi

    Sniperemi

    Joined:
    May 23, 2015
    Posts:
    5
    Hi!
    Great system here, I have been working with it only a few hours so I may have missed something but will we be able to set manually a smart parameter for components?

    Example:
    I have a dropdown allowing the player to choose between the options:
    Profile 1
    Profile 2
    Profile 3
    For now I'm forced to create a PROFILE_1 entry along with the PROFILE_2 and PROFILE_3 ones.
    Instead, creating a PROFILE_X entry that will allow the translation to be "Profile X" with a smart parameter allowing me to set the X in the inspector would be nice.

    Another example is gender:
    I'm French and the word "High" can be translated according to gender depending on the parameter (High Quality is female and High Render Details are male for instance). I would love to have a single entry and choose the gender on each localized string.

    Thanks in advance, keep up the good work.

    P.S: Please add natively the Dropdown Localize component, that would be great
     
  2. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,787
    It sounds like you want to configure a named placeholder. There's many ways to do this but I think here you want a global variable https://docs.unity3d.com/Packages/com.unity.localization@0.11/manual/GlobalVariables.html

    You could use the metadata feature to mark the gender of an entry https://docs.unity3d.com/Packages/com.unity.localization@0.11/manual/Metadata.html

    This will be part of the localized properties feature coming in the future.
     
  3. Sniperemi

    Sniperemi

    Joined:
    May 23, 2015
    Posts:
    5
    Hi ! Thanks for your quick answer.

    I tried manipulating Global Variables a little more but once again, I am not able to set a specific variable for a single LocalizedString. Here is my attempt of using a single Table Entry named "Profile" and use it a few times in a row with a custom global variable for each:
    global.png

    I added {global.one} to the first entry
    Setting {global.two} to the second one applies it to the global entry and thus the first one so they both have {global.two}

    Am I missing something ?

    Same thing with the metadata, I can't add metadata per component and thus can't use a single entry and setting the gender for a component and not the other. Or can I ?

    Thank you for your time
     
  4. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,787
    Hmm Im not entirely sure I understand what you are doing.
    You have a dropdown of different values that you want to localize?
    In English they will say
    Profile 1
    Profile 2
    Profile 3 etc?

    Is it just that you want to change the number at the end?

    For example when you initialize your script you could do something like this:
    Code (csharp):
    1.  
    2. for (int i = 0; i < numItems; ++i)
    3. {
    4.     localizedStrings[i].Arguments = new object[]{ i };
    5. }
    Then your localized string would look like "Profile {0}", "Profil {0}" etc.
     
  5. Sniperemi

    Sniperemi

    Joined:
    May 23, 2015
    Posts:
    5
    I know it is possible to do that by coding, what I would like is precisely not doing that by coding.
    For instance, the ideal would be to have a smart entry configured like this:
    Profile {0}
    And on the LocalizedString on the component, being able to manually set a value replacing the argument like the way OnClick events work on buttons where we can call a function and have an input field to manually set the parameter.

    This could also be used for a lot of smart settings. A gender example would be having a smart string in french for "High" translated by "Élevé" but with an extra "e" when female being something like this:
    {0:Élevé|Élevée}
    and enabling a box for female components without having a script only for this small purpose.

    I don't know if it is clear ?
     
  6. karl_jones

    karl_jones

    Unity Technologies

    Joined:
    May 5, 2015
    Posts:
    7,787
    Ah ok I see. So a bit like the global variables but only applied to the LocalizedString that they are attached to?
    That makes sense. Ill look into it for the future
     
  7. Sniperemi

    Sniperemi

    Joined:
    May 23, 2015
    Posts:
    5
    Exactly !
    Glad I managed to make it understandable.
    Thank you for your time, looking forward to testing the 1.0.0 pre version and will use specific entries until then
     
    karl_jones likes this.