Advanced Template Tricks

Advanced Template Tricks

Telegram Support

Templates load in alphabetical order

In case of conflicts, the last loaded file takes effect.

If you rename the official templates by adding 0 in front of them, you can force them to always load first

For instance:

  1. tl_*0*_general_en.txt
  2. tl_*0*_redirect.txt
  3. tl_null.txt

Since numbers come before letters, the templates starting with *zero* will always load before the templates starting with letters. 

Duplicate *{KEYS}* are overridden by the last loaded template

In the above file order, if *tl_null.txt* has any duplicate *{KEYS}*, then Tsupport will always take *tl_null.txt's {VALUES}*, because they were the last loaded templates. This way we can override any duplicate *{KEYS}* from the official template file. 

For instance, say we wanted to change: 

(Inside *tl_0_general_en.txt*)

  {KEYS}
  hi
  {VALUE}
  Hello, can I help you with Telegram?


We could place this text inside *tl_null.txt*: 

  {KEYS}
  hi
  {VALUE}
  Welcome to Telegram Support for North America!


Because *tl_null.txt* loads later, if we type "hi*<Tab>*" inside Tsupport, it will say: 

   "Welcome to Telegram Support for North America!"


Overwriting regional templates by renaming files

Say we have these 4 templates: 

  tl_general_en.txt
  tl_redirect.txt
  tl_usa.txt
  tl_india.txt


Now if *tl_usa.txt* had this text: 

  {KEYS}
  hi
  {VALUE}
  Welcome to Telegram Support for North America!


*tl_india.txt* could have this text: 

  {KEYS}
  hi
  {VALUE}
  Welcome to Telegram Support for India!


We can then change the order of the templates, to choose which template to prioritize in which region. 

For instance, in our Tsupport USA client, we could rename the files like this: 

  1. tl_0_general_en.txt
  2. tl_1_redirect.txt
  3. tl_2_india.txt
  4. tl_*3*_usa.txt

And in our Tsupport India client, we could rename the files like this: 

  1. tl_0_general_en.txt
  2. tl_1_redirect.txt
  3. tl_2_usa.txt
  4. tl_*3*_india.txt

This way, if we type "hi*<Tab>*" in TSupport USA, it will say: 

   "Welcome to Telegram Support for North America!"


And if we type "hi*<Tab>*" in TSupport India it will instead say: 

   Welcome to Telegram Support for India!


By ordering templates, we can now utilize duplicate *{KEYS}* and regional templates, without worrying about template conflicts. 

This can be useful if you are supporting users who originally came from outside your region, and hence ask questions commonly answered in other regional templates, but not in your primary regional template. 

Backing up older templates

A simple way to backup a template file is to add the *date* before the filename. 

For instance, if the file was: 

   tl_null.txt


We could copy the file, and rename this backup as: 

   150224-tl_null.txt (yymmdd)


Because templates must start with "*tl_*" for Tsupport to consider them as template files, the backup file with the prefixed date will *not* be loaded by Tsupport. You can use this method to keep different inactive versions of templates. 

This way you do not have to change the file extension to .old, so that all templates can still be quickly opened in text editors when comparing versions.


Report Page