Riquleme wrote:As we know we read strings form SIL by using siLang->GetTextOrDefault("IDS_0") by default, my question is that is there a funfction that can return String ID in Strings property by providing string contents (AnsiString) and language ID(Int or AnsiString) as parameters? Or something similar to this?
We also did need to find IDS from string and developped some code to do it.
1) a method to read SIB files and get all the IDS and their translations;
2) a method to search a given string in a given language and get back its IDS;
3) a method to add these strings into the TsiLang strings collections (as pointed out by Igor).
But you could also fullfill your need with TsiLang standard methods.
1) create a new DataModule on which you drop a TsiLang component;
2) move all your
common strings into that module;
3) add a reference to it in your
Use sections;
4) add test in your App Initialization to create this DataModule if not done yet.
N.B. While mooving your strings, you should concatenate groups of strings into complete sentences, such as this:
Code: Select all
Dialog('Please check node #' + IntToStr(NodeNumber) + ', it does not respond!')
which should be replace with this:
Code: Select all
Dialog(format(GlobalStr_NodeNotResponding, [NodeNumber]))
Then, in your DataModule, you should find this declaration:
Code: Select all
GlobalStr_NodeNotResponding = 'Please check node #%d, it does not respond!'
Then, in your SIB or SIL, you would be free to reverse the position of the words in your sentence, according to the destination language, such as: