Am Tuesday 14 August 2012 03:28:26 schrieb waldo kitty: > On 8/13/2012 05:09, Rainer Stratmann wrote: > > Am Monday 13 August 2012 10:35:55 schrieb Lukasz Sokol: > > [TRIM] > > >> You were saying, that you want to know, which string has not been > >> used / which string has been used and how many times ? > > > > I want to knof if the string was called the first time. > > But since I also get the pchar information of the textsnippets from the > > programmemory I can translate (make a list or whatever in the future) all > > snippets before they were called. > > i've been following this whole thread with interest... one thing that i'm > still not clear about, though, is why is this important? is it to see what > areas of the program are actually used or something else? Yes. It has to do with that. > in my mind, a > multi-language tool will have all strings translated into the supported > languages... The translation is a different thing to that. > if there are some that are ambiguous or used in a different > way, then they would get broken down further for proper language > constructs... I do not understand this... > while i have numerous tools and utils out in the wild being > used on a daily bases, none of them are multi-language but i do look > forward to the day when i can produce such with minimal effort in coding... > i have to leave it to others to do the actual translations, though...
I put only ls('snippet1'), ls('snippet2'), ls('snippet3')... around the text everywhere I want a translation. This is also better if you are searching for text in the program. You find then exactly the position you want. The program then is - now before all ls() are executed - making a list of all caller adresses (handles) and of all snipets. Caller adresses Table: 1 $0885BE80 2 $0886CE55 3 $088FF717 4 $0892B385 ID Table 1 snippet1 2 snippet2 3 snippet3 4 ID313 Snippet Table (original language) 1 snippet1 2 snippet2 3 snippet3 4 very long text snippet Snippet Table (language 2) 1 schnipsel1 2 schnipsel2 3 schnipsel3 4 sehr langer text schnipsel The ls procedure can get its (unique) caller adress and quickly search in the caller adress table and then knows the array nr of the translation. You can make other tables (or fields in an array) for each translation for example. The translation is done somewhere else (for example online http://109.91.95.104/sprache). There is a file with all snippets and translations (handles _not_ included, because they may change with each execution of the program). In this file you can store all information you want (date of creation, date of change, and so on). If you have a very long snippet then for example you can give the snippet another identifyer by marking the identifyer with two '~' at the beginning of the text snippet, for example: ls ('~ID313~very long text snippet' ). With the shorter text snippets the snippet itself is the identifyer. If you work with aliases as identifyer then an additional field is required as shown above. Again: all you have to do in the program is putting a ls() everywhere around you want a translation. No need for tons od additional identyfiers and additional lines like: var p_snippet1 : pchar; p_snippet2 : pchar; p_snippet3 : pchar; const id_snippet1 = 'ids_snippet1'; id_snippet2 = 'ids_snippet2'; id_snippet3 = 'ids_snippet3'; p_snippet1 := trlt( id_snippet1 ); p_snippet2 := trlt( id_snippet2 ); p_snippet3 := trlt( id_snippet3 ); writeln( p_snippet1 ); writeln( p_snippet2 ); writeln( p_snippet3 ); My solution: writeln( ls( 'snippet1' ) ); writeln( ls( 'snippet2' ) ); writeln( ls( 'snippet3' ) ); _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal