Announcement

Collapse

Forum Rules

  • No flaming or derogatory remarks, directly or through insinuation.
  • No discussion, sharing or referencing illegal software such as hacks, keygen, cracks and pirated software.
  • No offensive contents, including but not limited to, racism, gore or pornography.
  • No excessive spam/meme, i.e. copious one liners in a short period of time, typing with all caps or posting meme responses (text/image).
  • No trolling, including but not limited to, flame incitation, user provocation or false information distribution.
  • No link spamming or signature advertisements for content not specific to Dota 2.
  • No Dota 2 key requests, sell, trade etc.
  • You may not create multiple accounts for any purpose, including ban evasion, unless expressly permitted by a moderator.

  • Please search before posting. One thread per issue. Do not create another thread if there is an existing one already.
  • Before posting anything, make sure you check out all sticky threads (e.g., this). Do not create new threads about closed ones.
  • It is extremely important that you post in correct forum section.

  • Balance discussion only in Misc.
  • All art related (such as hero model) feedbacks go to Art Feedback Forum.
  • All matchmaking feedback should go here: Matchmaking Feedback
  • All report/low priority issues should go here: Commend/Report/Ban Feedback
  • No specific workshop item feedback. These should go to workshop page of that item.
  • When posting in non-bugs section (such as this), use [Bugs], [Discussion] or [Suggestion] prefix in your thread name.



In case you object some action by a moderator, please contact him directly through PM and explain your concerns politely. If you are still unable to resolve the issue, contact an administrator. Do not drag these issues in public.



All rules are meant to augment common sense, please use them when not conflicted with aforementioned policies.
See more
See less

$.Localize and dialog variables

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • $.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
    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.

    Comment


    • #3
      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 .

      Comment


      • #4
        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.

        Comment

        Working...
        X