Recent

Author Topic: Add 'Language' property to Controls with Text?  (Read 47483 times)

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Add 'Language' property to Controls with Text?
« Reply #30 on: August 03, 2012, 05:43:37 pm »
Well, maybe my idea isn't so crazy after all.  I was looking for a solution and found some stuff about MicroSoft VB and C#.  I have no way to confirm this, but from what I read, you are able to set 'Language' at least at the 'Application' level.  I don't know if you can set it at the component level.  There is a very simple method of creating resource strings right in the IDE and I 'think' there is a 'Localizabe' property for controls.  So it appears that when you change the 'Language' all of your Forms are Translated.  It also activates Language Keyboards and selects Sort methods.  As I said, I have no way to confirm any of this.  But if any of this is true, then MS VB and C# are way ahead of Lazarus when it comes to languages.  Oh yes, Forms also have a 'RightToLeftLayout' property that will mirror the Form for RightToLeft Forms.  These are things I can only dream about with Lazarus, but I'm a 'Pascal man' so I'm not leaving Lazarus.
Lazarus Trunk / fpc 2.6.2 / Win32

Knipfty

  • Full Member
  • ***
  • Posts: 230
Re: Add 'Language' property to Controls with Text?
« Reply #31 on: August 03, 2012, 06:01:07 pm »
You mean there are other languages besides English?   Next you will be telling me there are other currencies than the US Dollar... :o
32-bit Lazarus 1.0 FPC 2.6.0, 64-bit Win 7, Advantage DB 10.10

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Add 'Language' property to Controls with Text?
« Reply #32 on: August 03, 2012, 06:19:48 pm »
Hahah!  You may not believe this, but there other calendars too  ;)  And then there's those crazy countries that drive on the 'wrong' side of the road or think 3 feet makes a yard.
Lazarus Trunk / fpc 2.6.2 / Win32

Knipfty

  • Full Member
  • ***
  • Posts: 230
Re: Add 'Language' property to Controls with Text?
« Reply #33 on: August 03, 2012, 06:32:05 pm »
No way!   :o
I need to get out more...
32-bit Lazarus 1.0 FPC 2.6.0, 64-bit Win 7, Advantage DB 10.10

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Add 'Language' property to Controls with Text?
« Reply #34 on: August 03, 2012, 06:45:45 pm »
Well, maybe my idea isn't so crazy after all.  I was looking for a solution and found some stuff about MicroSoft VB and C#.  I have no way to confirm this, but from what I read, you are able to set 'Language' at least at the 'Application' level.  I don't know if you can set it at the component level.
Sorry if I'm being too obvious here or if this has been raised before, but how do current Delphi versions deal with this? If it's any good, we could emulate it and gain compatibility at the same time...
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Add 'Language' property to Controls with Text?
« Reply #35 on: August 03, 2012, 06:49:18 pm »
I wish I knew, but I quit upgrading at Delphi 6.  I tried to find something about current Delphi but came up empty.
Lazarus Trunk / fpc 2.6.2 / Win32

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5526
    • wiki
Re: Add 'Language' property to Controls with Text?
« Reply #36 on: August 03, 2012, 06:58:09 pm »
You mean there are other languages besides English?   Next you will be telling me there are other currencies than the US Dollar... :o
<sarcasm on>
You live in the US? Then you should know. Not sure what language you use, but it isn't English, according to a quote from "My fair Lady":
    "There even are places where English completely disappears. Why, in America they haven't used it for years!"

Knipfty

  • Full Member
  • ***
  • Posts: 230
Re: Add 'Language' property to Controls with Text?
« Reply #37 on: August 03, 2012, 07:35:16 pm »
Yes.  USA.  And that quote is very accurate...
32-bit Lazarus 1.0 FPC 2.6.0, 64-bit Win 7, Advantage DB 10.10

Avishai

  • Hero Member
  • *****
  • Posts: 1021
« Last Edit: August 03, 2012, 08:20:40 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

taazz

  • Hero Member
  • *****
  • Posts: 5363
Re: Add 'Language' property to Controls with Text?
« Reply #39 on: August 03, 2012, 08:25:09 pm »
Well, it looks like current Delphi does have at least some of these features.

http://www.delphibasics.co.uk/Method.asp?NameSpace=System.Globalization&Class=CultureInfo&Type=Class&Method=GetCultures

http://www.delphibasics.co.uk/NameSpace.asp?Name=System.Globalization&Part=CultureInfo

Those are .NET specific as far as I know there is nothing similar for win32/64 and since delphi.net has been dropped in favor of Oxygene that is an inaccurate statement.  I have no idea my self how delphi supports I"ll have to locate my d2007 installation and take a look. I'll try to post more info later.
Good judgement is the result of experience … Experience is the result of bad judgement.

OS : Windows 7 64 bit
Laz: Lazarus 1.4.4 FPC 2.6.4 i386-win32-win32/win64

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Add 'Language' property to Controls with Text?
« Reply #40 on: August 13, 2012, 12:08:46 pm »
I think all this recent talk about whether Lazarus Install should default to English or not,  Adding a Setup Dialog to Lazarus Installation so the user can select a Language and so on gives a lot of credit to the idea of adding a Language property to controls, starting from TApplication.Language.  Language really is an issue, even for the Lazarus IDE.
Lazarus Trunk / fpc 2.6.2 / Win32

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Add 'Language' property to Controls with Text?
« Reply #41 on: August 21, 2012, 04:46:39 pm »
Does anybody have a modern version of Delphi that could check to see if it has language support?  I tried to get the Trial version, but my country is blocked by Embarcadero from getting the Trial version.  Same for Microsoft.
« Last Edit: August 21, 2012, 09:40:34 pm by Avishai »
Lazarus Trunk / fpc 2.6.2 / Win32

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Add 'Language' property to Controls with Text?
« Reply #42 on: August 28, 2012, 02:20:34 pm »
I just found a very interesting article about MicroSoft Globalization/Localization and Sorting regardless of Language.  Naturally it's only for Windows.

http://msdn.microsoft.com/en-us/goglobal/bb688122
Lazarus Trunk / fpc 2.6.2 / Win32

Avishai

  • Hero Member
  • *****
  • Posts: 1021
Re: Add 'Language' property to Controls with Text?
« Reply #43 on: August 31, 2012, 08:09:15 pm »
I think the strongest argument in favor of adding 'Language' to controls is the sorting issue.

Example:
You write a program in English that has ListBoxes and ComboBoxes with predefined strings in them.  You set the Sort property to true.  Everything looks good.  Then you give a copy to a Russian and another to a Greek.  They report back that the strings are translated correctly, but are sorted in RANDOM order.  So you do your research and find the right sort methods for Russian and Greek.  But how do you release your program to the general public???  Do you have to do this for EVERY LANGUAGE!?  And how do I know if I'm using the right method for a language I can't read???  Arabic is a beautiful written language, but I can't even tell where a character begins and ends.

By adding a Language property and a decision tree for sort methods based on Language Number that can be worked on by the entire Lazarus community, you would be able to simply say "Sort" and it wouldn't matter if it was running on a Japanese or French Locale.

I only recently discovered that the "Standard" sort methods are not case sensitive which introduces yet another form of randomness.  There is a way around it of course, but it seems odd that a seemingly simple task of sorting a list has to be so complex, including numeric sort.

Of course Activating the correct Keyboard Language is an issue as well, but maybe not a severe as sorting.
Lazarus Trunk / fpc 2.6.2 / Win32

Phil

  • Hero Member
  • *****
  • Posts: 2750
Re: Add 'Language' property to Controls with Text?
« Reply #44 on: August 31, 2012, 08:18:26 pm »
I think the strongest argument in favor of adding 'Language' to controls is the sorting issue.

I've never heard of a "Language" property at the control level. Can you cite a single UI framework that does it that way?

For example, if you look at Apple's internationalization guidelines, you see that sorting based on locale is the developer's responsibility:

https://developer.apple.com/library/mac/#documentation/MacOSX/Conceptual/BPInternational/Articles/InternatAndLocaliz.html

Thanks.

-Phil