Skip to content

multilang: strange behaviour when selecting dts templates #317

@philcerf

Description

@philcerf

Hey.

Was playing with multilang in develop and noticed the following strange behaviour.

For monster I have e.g. these (amongst others):

  {
    "id": 1,
    "language": "en",
    "type": "monster",
    "default": false,
    "platform": "telegram",
    "template": {
      "content": "{{round iv}}% {{name}}{{#if form}}{{#isnt formName 'Normal'}} {{formName}}{{/isnt}}{{/if}} cp:{{cp}} L:{{level}} {{atk}}/{{def}}/{{sta}} {{boostWeatherEmoji}}\nEnd: {{time}}, Time left: {{tthm}}m {{tths}}s \n {{#if weatherChange}}{{weatherChange}}\n{{/if}} {{{addr}}} \n quick: {{quickMoveName}}, charge {{chargeMoveName}} \n {{#if pvp_rankings_great_league}}{{#compare bestGreatLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestGreatLeagueRankCP '>=' pvpDisplayGreatMinCP}}**Great league:**\n{{/compare}}{{/compare}}{{#each pvp_rankings_great_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayGreatMinCP}} - {{pokemonName this.pokemon}} #{{this.rank}} @{{this.cp}}CP (Lvl. {{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}{{#if pvp_rankings_ultra_league}}{{#compare bestUltraLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestUltraLeagueRankCP '>=' pvpDisplayUltraMinCP}}**Ultra League:**\n{{/compare}}{{/compare}}{{#each pvp_rankings_ultra_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayUltraMinCP}} - {{pokemonName this.pokemon}} #{{this.rank}} @{{this.cp}}CP (Lvl. {{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}} Maps: [Google]({{{googleMapUrl}}}) | [Apple]({{{appleMapUrl}}})",
      "sticker": "{{{stickerUrl}}}",
      "location": true,
      "webpage_preview": true
    }
  },
  {
    "id": "-0-pvp-mapimg-maplnk",
    "language": "en",
    "type": "monster",
    "default": true,
    "platform": "telegram",
    "template": {
      "content": "*{{name}}{{#is gender 1}}{{#isnt id 32}}\u00A0{{genderData.emoji}}{{/isnt}}{{else}}{{#is gender 2}}{{#isnt id 29}}\u00A0{{genderData.emoji}}{{/isnt}}{{/is}}{{/is}}{{#if form}}{{#isnt formName 'Normal'}} {{formName}}{{/isnt}}{{/if}} {{cp}}\u00A0CP (lvl\u00A0{{level}}){{#if boost}}\u2003{{boostWeatherEmoji}}{{/if}}*\n📊\u00A0*{{round iv}}% ({{atk}}/{{def}}/{{sta}}) IV*\n{{#if pvp_rankings_great_league}}{{#compare bestGreatLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestGreatLeagueRankCP '>=' pvpDisplayGreatMinCP}}🔵\u00A0*Great League:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_great_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayGreatMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0CP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}{{#if pvp_rankings_ultra_league}}{{#compare bestUltraLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestUltraLeagueRankCP '>=' pvpDisplayUltraMinCP}}⚫\u00A0*Ultra League:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_ultra_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayUltraMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0CP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}🕓\u00A0*{{time}} ({{tthm}}min\u00A0{{tths}}s)*\n[\u200B]({{{staticMap}}})🗺️\u00A0[Google Maps]({{{googleMapUrl}}})\u2003[Apple Maps]({{{appleMapUrl}}})",
      "sticker": "",
      "location": true,
      "webpage_preview": true
    }
  },
  {
    "id": "-0-pvp-mapimg-nomaplnk",
    "language": "en",
    "type": "monster",
    "default": false,
    "platform": "telegram",
    "template": {
      "content": "*{{name}}{{#is gender 1}}{{#isnt id 32}}\u00A0{{genderData.emoji}}{{/isnt}}{{else}}{{#is gender 2}}{{#isnt id 29}}\u00A0{{genderData.emoji}}{{/isnt}}{{/is}}{{/is}}{{#if form}}{{#isnt formName 'Normal'}} {{formName}}{{/isnt}}{{/if}} {{cp}}\u00A0CP (lvl\u00A0{{level}}){{#if boost}}\u2003{{boostWeatherEmoji}}{{/if}}*\n📊\u00A0*{{round iv}}% ({{atk}}/{{def}}/{{sta}}) IV*\n{{#if pvp_rankings_great_league}}{{#compare bestGreatLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestGreatLeagueRankCP '>=' pvpDisplayGreatMinCP}}🔵\u00A0*Great League:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_great_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayGreatMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0CP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}{{#if pvp_rankings_ultra_league}}{{#compare bestUltraLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestUltraLeagueRankCP '>=' pvpDisplayUltraMinCP}}⚫\u00A0*Ultra League:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_ultra_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayUltraMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0CP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}🕓\u00A0*{{time}} ({{tthm}}min\u00A0{{tths}}s)*\n[\u200B]({{{staticMap}}})🗺️\u00A0[Google Maps]({{{googleMapUrl}}})\u2003[Apple Maps]({{{appleMapUrl}}})",
      "sticker": "",
      "location": false,
      "webpage_preview": true
    }
  },

...

  {
    "id": "-0-pvp-mapimg-maplnk",
    "language": "de",
    "type": "monster",
    "default": true,
    "platform": "telegram",
    "template": {
      "content": "*{{name}}{{#is gender 1}}{{#isnt id 32}}\u00A0{{genderData.emoji}}{{/isnt}}{{else}}{{#is gender 2}}{{#isnt id 29}}\u00A0{{genderData.emoji}}{{/isnt}}{{/is}}{{/is}}{{#if form}}{{#isnt formName 'Normal'}} {{formName}}{{/isnt}}{{/if}} {{cp}}\u00A0WP (lvl\u00A0{{level}}){{#if boost}}\u2003{{boostWeatherEmoji}}{{/if}}*\n📊\u00A0*{{round iv}}% ({{atk}}/{{def}}/{{sta}}) IV*\n{{#if pvp_rankings_great_league}}{{#compare bestGreatLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestGreatLeagueRankCP '>=' pvpDisplayGreatMinCP}}🔵\u00A0*Superliga:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_great_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayGreatMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0WP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}{{#if pvp_rankings_ultra_league}}{{#compare bestUltraLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestUltraLeagueRankCP '>=' pvpDisplayUltraMinCP}}⚫\u00A0*Hyperliga:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_ultra_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayUltraMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0WP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}🕓\u00A0*{{time}} ({{tthm}}min\u00A0{{tths}}s)*\n[\u200B]({{{staticMap}}})🗺️\u00A0[Google Maps]({{{googleMapUrl}}})\u2003[Apple Maps]({{{appleMapUrl}}})",
      "sticker": "",
      "location": true,
      "webpage_preview": true
    }
  },
  {
    "id": "-0-pvp-mapimg-nomaplnk",
    "language": "de",
    "type": "monster",
    "default": false,
    "platform": "telegram",
    "template": {
      "content": "*{{name}}{{#is gender 1}}{{#isnt id 32}}\u00A0{{genderData.emoji}}{{/isnt}}{{else}}{{#is gender 2}}{{#isnt id 29}}\u00A0{{genderData.emoji}}{{/isnt}}{{/is}}{{/is}}{{#if form}}{{#isnt formName 'Normal'}} {{formName}}{{/isnt}}{{/if}} {{cp}}\u00A0WP (lvl\u00A0{{level}}){{#if boost}}\u2003{{boostWeatherEmoji}}{{/if}}*\n📊\u00A0*{{round iv}}% ({{atk}}/{{def}}/{{sta}}) IV*\n{{#if pvp_rankings_great_league}}{{#compare bestGreatLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestGreatLeagueRankCP '>=' pvpDisplayGreatMinCP}}🔵\u00A0*Superliga:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_great_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayGreatMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0WP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}{{#if pvp_rankings_ultra_league}}{{#compare bestUltraLeagueRank '<=' pvpDisplayMaxRank}}{{#compare bestUltraLeagueRankCP '>=' pvpDisplayUltraMinCP}}⚫\u00A0*Hyperliga:*\n{{/compare}}{{/compare}}{{#each pvp_rankings_ultra_league}}{{#if this.rank}}{{#compare this.rank '<=' ../pvpDisplayMaxRank}}{{#compare this.cp '>=' ../pvpDisplayUltraMinCP}}\u2003•\u00A0{{pokemonName this.pokemon}}: #{{this.rank}} ({{this.cp}}\u00A0WP, lvl\u00A0{{this.level}})\n{{/compare}}{{/compare}}{{/if}}{{/each}}{{/if}}🕓\u00A0*{{time}} ({{tthm}}min\u00A0{{tths}}s)*\n[\u200B]({{{staticMap}}})🗺️\u00A0[Google Maps]({{{googleMapUrl}}})\u2003[Apple Maps]({{{appleMapUrl}}})",
      "sticker": "",
      "location": false,
      "webpage_preview": true
    }
  },

So there's basically 1 (with en, however default=false) from the upstream example dts.json, than my own ones, with first one en with default=true some more in en with default=false and then the same for de.

Now when I do /language de and set a tracking rule without any templates it correctly uses the anticipated one, but when I use /language en it always goes to template1, even if I e.g. change the order and put it behind "my" en-default.

Cheers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions