Automation of Text Symbol Creation

Many times we are required to create text symbols for hardcoded texts, reason being that with text symbols translation becomes possible and then the same program can be used across different regions/countries with other languages.

Depending upon the number of the hardcoded text one has in his/her program text symbol creation can become either an easy or a difficult job. To create text symbol one can simply double click the hardcoded text and it will ask if you want to create a text symbol, then you move to the text symbol screen where you save and return back.

As a part of a CI initiative my company we managed to automate this process. We simply execute a program (source code provided below) and provide it with the ‘PROGRAM NAME’ of which we want to create text symbol and that’s it! The program create the text symbols where ever its necessary.

The information on which text is required for translation is picked up from extended code check program. Also if you have yourself given a number to a hardcoded text and forgot to create a text symbol for it, the program would do it for you. If you already have some text symbols created and are adding new ones then the next number is picked up by the program.

Using this program we were able to cut down on the development time. When I am coding I do not worry if I have to create a text symbol for the text and surely save some CLICKS.

One can modify the code as per his/her requirement. Also if you have any suggestions or improvement please do let me know.

Yes, I had that scenario in mind too where text is different in editor and in text symbol, but was not able to code for it due to time constraint. We had to create over 800 text symbols and hence this program was created overnight. Thanks Shai.

This is a very good idea, regardless of how badly the program is written. I am able to write really good programs (I hope) but coming up with brand new ideas is much more difficult, and this had never occurred to me.

I can fix up bad programs – having new ideas is much more difficult!

I tend to take such example programs from SCN, and totally re-write them, and then shove the result back onto SCN, as I did with the automated dependency injection framework.

Going back to text symbols, in particular the problem I have is that it is agony using text symbols with curly brackets and pipes, such as:-

ERROR_MESSAGE = |The widget has { number_of_flaws} flaws|.

If you double click on the text then nothing happens. You have to put the txet soemwhere else, in a line you are going to delete, then doublec lucik on it to generate the text symbol, then put that text symbol in your pipe structure, surronded in curly brackets this time, then delete the line you first thought of.