Language messages at our library

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Language messages at our library

Post by Pablo César »

Since long time I'm saying "these translations that are in various languages​​, thus demanding conditions of various items in the code and this is a very important point that must be seen and re-evaluated in order to be detached from the source code. Instead, perhaps as a solution, in the future there may be a file (perhaps. INI) for each language."

Here in this message I'm presenting one idea, to put several languages in one INI file and sections by each language.
But this way will demand to a necessary attached INI file with exe file of our applications.

Another idea, given by Claudio, is to make it by INCLUDE file with an array of each message.
Then all these definitions/xtranslate will make part of builded application.

I have been thinking a lot about it and I see a way to do it time before when at moment of building applications.
Programmer will choose by selective option which language is being include as default language in unique file but containing according the choosen language.

Suggestions are very good wellcome. My wish and I believe of many other is to get clean code of our HMG not being part of our source code. IMHO this just a dictionary for interface texts and messages for each languages.

My suggestion is to take both ideas and join it as folows:
  1. In my mind I'm thinking to collect all HMG texts and messages for interface and make a indexed file.
    This we could named as "Dictionary.ch" and at beginning with English text inside as default.
     
  2. To be created a single INI file containing its text of each languages. Like this (for example):
    Screen1.png
    Screen1.png (20.69 KiB) Viewed 7137 times
    And this INI file we can named as "Languages.lng"
     
  3. At moment of building app. Will need to choose by selecting language option or reading by enviroment variable pre-defined language. In this way, a HMG tool could extract only the selected/defined language a make copy to "Dictionary.ch" file.
    This selecting option of language, it could be done in our IDE and also actioning by Build.bat at prompt command.
The Dictionary.ch always will be part of including at main HMG library. But it contains could it differed according selected language.

All of this is just an idea.
Everyone is invited to make your participation.
Probably we can collect many ideas to get better solution for this.

Regards
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: Language messages at our library

Post by Rathinagiri »

Nice idea Pablo.

Instead of having numbered identifiers we can use the named identifiers. By that way, there won't be any confusion in using them inside prg.
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Javier Tovar
Posts: 1275
Joined: Tue Sep 03, 2013 4:22 am
Location: Tecámac, México

Re: Language messages at our library

Post by Javier Tovar »

Rathinagiri wrote:Nice idea Pablo.

Instead of having numbered identifiers we can use the named identifiers. By that way, there won't be any confusion in using them inside prg.
+1

Muy interesante!
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Language messages at our library

Post by Pablo César »

Rathinagiri wrote:Instead of having numbered identifiers we can use the named identifiers
Thank you Rathi for your interest and tips ! :P
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: Language messages at our library

Post by esgici »

My humble opinion is:

My teacher used to say: Do not put all eggs in one basket ;)

How will be "Language Messages" system used in IDE: two separate file for each language : UNI and ANSI ?

May be only English hard coded in h_init.prg; a single "hmg.ini" file in hmg root folder include two values : "hmg source folder" and "Interface Language" )

Viva HMG :D
Viva INTERNATIONAL HMG :D
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Language messages at our library

Post by Pablo César »

esgici wrote:"Language Messages" system used in IDE: two separate file for each language : UNI and ANSI ?
At your text in red color, you tried to say encode mode in place, doens't it ?
You're right and I also agreed with that. It would have two format files, is a matter of keeping evidence in the pattern of the strings and the file type too.

May be only English hard coded in h_init.prg
In this case, I believe should it be replaced by named identifiers as Rathi has indicated, otherwise will be needed two ways English and variable. So IMHO, is better to use this oportunity to let unique as variable.

a single "hmg.ini" file in hmg root folder include two values : "hmg source folder" and "Interface Language"
Are you referring to the configuration file for IDE ?
In this case, I also believe will should let INI file separated with the language file for library.
Because I think when we select language for IDE it doesn't means it will be the same language for the user application.
For example, in my case, I use IDE in English but my apps are sometimes in Portuguese, sometimes in Spanish.

But I agree to join all INI files regarding IDE, its will simplify and all languages can be easily managed in just one INI file with recently new functions: HMG_GetPrivateProfileSectionNames and HMG_GetPrivateProfileSection.
This file for IDE, IMHO should be named as IDE.ini to keep these configurations data: HMG root path (for compilation propose), IDE language, also there is the source code editor path/executable and UseBuildBat info (32/64 bits) to be stored too (4 informations).

But I have my doubts regarding IDE should share the same language file with the library one. :?

Because for library propose it will generate a Dictionary.ch and in the HMG IDE would use INI file directly.

Anyway, we would start with languages regarding texts and messages for our library only and Claudio (because we have not access of IDE sources :cry: ) try to unify all these INI files for our IDE ( editor.ini, hmg.ini, language_UNI.ini and UseBuildBat.ini ). This last indication it was made at long time ago at:
Screen2.png
Screen2.png (39.06 KiB) Viewed 7085 times
Is always good to know Claudio and Rathi opinions and indications, so then we could begin to untie the language within the source code.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
dragancesu
Posts: 921
Joined: Mon Jun 24, 2013 11:53 am
DBs Used: DBF, MySQL, Oracle
Location: Subotica, Serbia

Re: Language messages at our library

Post by dragancesu »

In principle I agree with the user esgici

One language must exist and be the default, and allow others added, probably a <language>.LNG files

UNI or ANSI? The first solution is perhaps better, and secondly because windows can support many codepage, the only question is when what he likes
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Language messages at our library

Post by Pablo César »

Hi Dragan, thank you for your interest.
dragancesu wrote:One language must exist and be the default
But English it will be as default language. Which I tried to explain, do not need to be inside of the source code, as it is now.
and allow others added
This is possible by anyway and will be very good welcome any contribution, specially to fix wrong translations or for new languages, because we are imagining to have all languages in one INI file and with a specific sequence.
probably a <language>.LNG files
As been mentioned before, we expected to have it not in separated, probably will separate only for UNI and ANS
UNI or ANSI? The first solution is perhaps better, and secondly because windows can support many codepage, the only question is when what he likes
It will be necessary BOTH modes. We need to managed according enconding mode.
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
apais
Posts: 440
Joined: Fri Aug 01, 2008 6:03 pm
DBs Used: DBF
Location: uruguay
Contact:

Re: Language messages at our library

Post by apais »

Insn't Harbour's i18n suitable for this task ?
Angel Pais
Web Apps consultant/architect/developer.
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Language messages at our library

Post by Pablo César »

Hi Angel, thanks for your interest.

The question is what to do with our internal messages, labels in our library ?

It's not a Harbour issue. :|
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
Post Reply