#1 2015-02-21 11:27:06

sergioschel
Member
From: Brazil
Registered: 2014-10-23
Posts: 9

Regional Settings Windows

Hi ab

I'm using mormot on an existing project but to call TimeToStr (Now) is returning with AM / PM (ex. "9:02:45 AM"). If I remove mormot project files the same function returns the time correctly (ex. "09:02:45").
In my Windows the default time format is HH: mm: ss (Portuguese Brazil).
I need the mormot work with the same format of my language in Windows.

Offline

#2 2015-02-21 12:16:14

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Regional Settings Windows

Weird.

I did not found any place in our source code where the global FormatSettings variable is changed by the framework...
Could you try to isolate which unit is doing the change?
Create a new project, then add units one by one: SynCommons, mORMot, mORMotSQLite3, mORMotDB, mORMotUI, mORMoti18n...

I guess that mORMoti18n is changing the current SysLocale.
But this is on purpose IMHO.

Try to define NOI18N conditional for your project.

Offline

#3 2015-02-21 12:31:15

sergioschel
Member
From: Brazil
Registered: 2014-10-23
Posts: 9

Re: Regional Settings Windows

In mORMoti18n (line 1247) always puts as lngEnglish, even if I set i18nLanguageToRegistry(lngPortuguese).
I'm using the mORMot_and_Open_Source_friends_2015-02-16_211520_112f15efcb sources

Last edited by sergioschel (2015-02-21 12:33:03)

Offline

#4 2015-02-21 14:35:28

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,659
Website

Re: Regional Settings Windows

Yes, it expects the pt.msg file to be available...

But I understand this is pretty confusing.

I've added a new aForceEnglishIfNoMsgFile optional parameter for SetCurrentLanguage().
And change the default behavior so that  any missing .msg file won't change the current locale.
See http://synopse.info/fossil/info/27aedaa271

Offline

#5 2015-02-21 15:46:03

sergioschel
Member
From: Brazil
Registered: 2014-10-23
Posts: 9

Re: Regional Settings Windows

Great ab
Thanks for the help, is now working. big_smile

Offline

#6 2015-03-06 07:39:05

proto
Member
From: Russia, Kostroma
Registered: 2011-09-12
Posts: 31

Re: Regional Settings Windows

great, but not all look fine.
original code

  // 2. handle missing .msg file
  LanguageForLanguageFile := aLanguage;
  if LanguageForLanguageFile<>lngEnglish then
    if not FileExists(TLanguageFile.FileName(LanguageForLanguageFile)) then begin
      if aForceEnglishIfNoMsgFile then
        if CurrentLanguage.Index=lngEnglish then
          exit else
          aLanguage := lngEnglish;
      LanguageForLanguageFile := lngEnglish; // no .msg -> no translation 
    end;

5264488.jpg

dates look bad, not default view dd.mm.yyyy

if change

  // 2. handle missing .msg file
  LanguageForLanguageFile := aLanguage;
  if LanguageForLanguageFile<>lngEnglish then
    if not FileExists(TLanguageFile.FileName(LanguageForLanguageFile)) then begin
      if aForceEnglishIfNoMsgFile then
        if CurrentLanguage.Index=lngEnglish then
          exit else
          aLanguage := lngEnglish;
      LanguageForLanguageFile := lngRussian; // CHANGED TO lngRussian
    end;

dates look fine
5282920.jpg

Do not know why such a difference

Last edited by proto (2015-03-06 07:58:54)

Offline

Board footer

Powered by FluxBB