Search code examples
delphichromiumchromium-embedded

Delphi DCEF3 - Change locale


I want to change the DCEF3 (Delphi Chromium Embedded 3) to display local data (like time and dates) in my language, Norwegian. Now it defaults to English.

I see that the source code has an own "locales" folder (https://code.google.com/p/dcef3/source/browse/#git%2Fbin%2FWin32%2Flocales). How do I tell the chromium component to use nb.pak?


Solution

  • Set the CefLocale variable to the name of the locale of your choice (which is the name of the locale file without extension). Do that before the first instance of TChromium is created. For instance, if you are having a TChromium component dropped on a form, do that from the form's OnCreate event:

    uses
      ceflib;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
      CefLocale := 'nb';
    end;
    

    If you keep this variable empty (which is its default value), the en-US locale will be used.