[fpc-pascal] Re: Get all caller adresses of a given function/procedure before executing

Rainer Stratmann RainerStratmann at t-online.de
Wed Aug 15 09:33:37 CEST 2012

Am Wednesday 15 August 2012 03:52:00 schrieb waldo kitty:
> On 8/14/2012 03:11, Rainer Stratmann wrote:
> > Am Tuesday 14 August 2012 03:28:26 schrieb waldo kitty:
> >> 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.
> ok... that's one part that is understandable from a statistics POV...

I am not this experienced with the english language, so sorry if I do noz 
understand everything 100%.
What means POV?

> >> in my mind, a multi-language tool will have all strings translated
> >> into the supported languages...
> >
> > The translation is a different thing to that.
> i don't understand... you have a list of the original strings and other
> lists of those strings translated into other languages... on startup, the
> program determines which language is chosen and it loads that translated
> language file... there is then no more translation needed... the program
> then simply uses those strings using the very same routines and no
> additional coding is needed... ???

Yes this way.
It can happen that a new text snippet is used in the program.
I use one file for all translations.

> >> 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...
> consider in english we might say "she opened the door" but in another
> language they might use the format of "door opened she"... basically what
> i'm trying to say is that the constructs of the sentences may be
> different...
Yes, then the whole sentence has to be translated.
> my comment above was looking that one might have to break down 
> that sentence "she opened the door" into multiple parts so that the
> translation would be performed and assembled in the output of the program
> easier...
In my program there are 2 types:
1. Easy to translate words or little sentences.
2. User manual with longer Text.

> >> 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 would be no different than the program doing

>    writeln(snippet1);

But then you have to define snippet1 (pascal language identifyer in your 
example). I do not need to define snippet1 somewhere else.

writeln( ls( 'snippet1' ) );

snippet1 here is the text (in my case in germany) already.
It is the written text and also the identifyer.

> when all strings are translated and stored in some translated language
> file... snippet1 in english would be the same snippet1 in german, dutch,
> japanese, etc... it is my understanding that this is also the way the
> existing *.po files work... the code simply loads english.po or german.po
> or klingon.po at the start of the program and after that, everything is the
> same...

I do not know how the different *.po files work.

> > This is also better if you are searching for text in the program. You
> > find then exactly the position you want.
> i understand what you are saying but i don't understand why... since you
> mentioned an online translation service, are you looking at using live
> translations instead of static ones stored in a language file??

The users (in their countries) can translate may be better then I can so.
For the english language I can do. Most people can understand english and from 
that language translate in their own language.

> [trim]
> > You can make other tables (or fields in an array) for each translation
> > for example. The translation is done somewhere else (for example online
> >
> so you are looking to perform live translations, then? what if that
> translation service disappears tomorrow? what about your users then?

What do you mean with live translations exactly?
The web server and translation service I program myself.
So it is available I think longer than until tomorrow.

> > There is a file with all snippets and translations (handles _not_
> > included, because they may change with each execution of the program).
> i don't see how a language can change from one day to the next or even one
> execution to the next...

One user uses english translation and the other dutch translation.
It is far more easier for me to put all languages in one file, because of less 
administration overhead then.
If the languages are in one file I can also easily add a creation date, add 
date for changed entries (date of creation, date of change) and so on...
Whatever I want and need for better administration and overview.

I have to write the code for that once and have the power for all snippets 

> [trim]
> > 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:
> but there's nothing like that with the existing po files if i'm
> understanding their purpose and method of use... 

I understand it that way that you have to define a pascal identifier for each 
snippet. I use the snippet itself as the identifyer. In combination with the 
caller address when calling the translate function ls().
If there are longer snippets (for example for the user manual) I will use 
other identifyers for that.

For example:
writeln( ls( '~ID555~longer user malual text ...' );
Then 'ID555' is the identifyer in the translation file.

If there is a new snippet a new entry with that snippet (and initially free 
entries for the other languages) is added automatically to the (one) 
translation file.

> the loading code simply 
> chooses the proper po file and then loads the strings into an array or
> whatever using the same variables which are used everywhere no matter what
> language their contents are written in...

Do you need a separate pascal identifier for each snippet?

> i must still be missing something :?

More information about the fpc-pascal mailing list