Results 1 to 6 of 6

Thread: [Bug] ToggleButton: unable to set property text="Normal"

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

    [Bug] ToggleButton: unable to set property text="Normal"

    There's something weird about assigning the text property of a ToggleButton to the word "Normal" or "normal"

    reproduction:

    <ToggleButton checked="true" text="Normal" />
    ToggleButton label shows up unexpectedly as "Base"

    <ToggleButton checked="true" text="normal" />
    ToggleButton label shows up unexpectedly as "Base"

    <ToggleButton checked="true" text="Normals" />
    ToggleButton label shows up as expected as "Normals"

  2. #2
    Basic Member
    Join Date
    Nov 2011
    Posts
    236
    Actually this bug applies for <Label> as well. can't set the text property to the word "normal"

    <Label text="Normal" /> also displays the word "Base"
    Last edited by Esteban; 10-17-2015 at 09:56 PM.

  3. #3
    Basic Member arhowk's Avatar
    Join Date
    Mar 2015
    Location
    Michigan, USA
    Posts
    210
    Thats because "normal" is defined as "Base" in DotA's localization files.
    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.

  4. #4
    Basic Member
    Join Date
    Nov 2011
    Posts
    236
    Ok I see it in "dota 2 beta\game\dota\resource\dota_english.txt", but I'm not using a '#' for my text property. Wouldn't it need to be text="#Normal" for the string to be localized to "Base"?

  5. #5
    Basic Member arhowk's Avatar
    Join Date
    Mar 2015
    Location
    Michigan, USA
    Posts
    210
    *Theoretically*, you should ALWAYS be localizing your strings, therefore the "#" in it is redundant.

    In practice, it makes more sense to require the # when localizing text. Not only does it make it more clear that you're looking for a localized string, but also localization is rarely ever used for testing purposes.

    However, volvo will run $.Localize on whenever you pass something to a text property. Thats volvo for you. It's more or less just a bunch of randomly stitched together subsystems working together to create one semi-working game.

    If you SERIOUSLY need to display "Normal" in a label, just localize a key that will translate to "Normal". (Putting "Normal " might also work, not sure.)
    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.

  6. #6
    Basic Member
    Join Date
    Nov 2011
    Posts
    236
    I see. Adding a space to my string is actually what I ended up doing to work around this, works/looks fine.

    Weird thing is that I originally encountered this bug by setting the text property in javascript dynamically from a nettable, and today having read the localisation page, I see it explicitly says that text set through javascript is not automatically localized.

    https://developer.valvesoftware.com/...a/Localization
    If you dynamically set the text of a label from Javascript, it will NOT automatically localize the string. If you need to dynamically assign a localization token to a label, you need to localize the string in Javascript. (This technique has limited support for dialog variables.)
    Anyways, thanks for the help, at least I now know why it was doing this.

Posting Permissions

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