Results 1 to 4 of 4

Thread: $.Localize and dialog variables

  1. #1
    Basic Member
    Join Date
    Nov 2011
    Posts
    2

    $.Localize and dialog variables

    Im having problems using $.Localize and dialog variables, when i try to localize a string containing dialog variables i get no text at all.

    I have read the documentation(https://developer.valvesoftware.com/...a/Localization) but it does not say anything about how the get the "limited support" to work.

    Being able to use $.Localize and dialog variables would help me a lot with the localization of my custom game, is there anyway to use localize and dialog variables or should look for other options?

  2. #2
    Basic Member arhowk's Avatar
    Join Date
    Mar 2015
    Location
    Michigan, USA
    Posts
    210
    First of all, dialog variables are deprecated. Use panel.data() instead. panel.data() returns a JS object that you can put things in.

    Secondly, $.Localize() takes a key and returns the value from the addon_your_local_language.txt file. If you're getting no text, thats either because you're feeding it a nil string or the value is defined as "" in the localization file. Both of these can be debugged by printing what you feed localize and checkign whats in your panorama/localization/addons_x.txt file

    Third, this forum is for development bugs and feedback. For help on using the tools, come to moddota.com
    Every time you have an issue, spend at least 5 minutes on each of these four sites Google, Wiki, Github, and ModDota
    If you still can't figure out your issue, post your issue on moddota in as much detail as possible with a SSCCE. If you do not complete these requirements, than you will be rejected by the community. Try not to contact individual users for help as we are very busy.

  3. #3
    Basic Member
    Join Date
    Nov 2011
    Posts
    2
    Secondly, $.Localize() takes a key and returns the value from the addon_your_local_language.txt file. If you're getting no text, thats either because you're feeding it a nil string or the value is defined as "" in the localization file.
    Well it works when i don't put a dialog variable in it, "MessageText" "My {s:adjective} number is {d:number}." returns a nil string, "MessageText" "My number is." returns "My number is.".

    First of all, dialog variables are deprecated. Use panel.data() instead. panel.data() returns a JS object that you can put things in.
    Does this https://developer.valvesoftware.com/...a/Localization is outdated?, If i can't trust the documentation where do i look for up to date information about panorama? and how would i use panel.data() with my addon_your_local_language.txt file(since the documentation only mentions dialog variables?)

    Third, this forum is for development bugs and feedback. For help on using the tools, come to moddota.com
    Yes i guess i might have posted this in the wrong place my bad .

  4. #4
    Basic Member arhowk's Avatar
    Join Date
    Mar 2015
    Location
    Michigan, USA
    Posts
    210
    Right, I've never used dialog variables for localization, I assumed you were referring to panel-to-panel interaction. I assume the "limited use" that they are referring to is your issue. If you want to use $.Localize, than it would look something like this

    Code:
    "SomeKey" "Sword %1 deals %2 damage"
    
    
    var baseText = $.Localize("#SomeKey");
    baseText = baseText.replace("%1", "Destroyerantor");
    baseText = baseText.replace("%2", "5535");
    $.Msg(baseText);
    //will print Sword Destroyernator deals 5535 damage
    Sorry I'm not totally familiar with this usage, someone on ModDota might be able to give you a nicer solution
    Every time you have an issue, spend at least 5 minutes on each of these four sites Google, Wiki, Github, and ModDota
    If you still can't figure out your issue, post your issue on moddota in as much detail as possible with a SSCCE. If you do not complete these requirements, than you will be rejected by the community. Try not to contact individual users for help as we are very busy.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •