Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[JA] Languages #297

Open
ht-deko opened this issue May 15, 2024 · 1 comment
Open

[JA] Languages #297

ht-deko opened this issue May 15, 2024 · 1 comment

Comments

@ht-deko
Copy link
Contributor

ht-deko commented May 15, 2024

When I change the language to Japanese, the characters are garbled.
([Tool | Environment Options...] > [General] Tab -> "Language:" )

image

@ht-deko
Copy link
Contributor Author

ht-deko commented May 15, 2024

This problem occurs because the code page cannot get from the language file.

[MultiLangSupport.pas]

procedure TdevMultiLangSupport.Open(const Filename: String);
var
  LangFile: String;
begin
  // Load file from languages directory
  LangFile := ValidateFile(Filename, devDirs.Lang);
  if LangFile = '' then begin
    MessageDlg('Could not open language file ' + Filename, mtError, [mbOK], 0);
    Exit;
  end;

  // Load file into fStrings
  fStrings.LoadFromFile(LangFile,TEncoding.ANSI);
  fLangFile := LangFile;

  // Get languange
  fCurLang := fStrings.Values['Lang'];
  if fCurLang = '' then
    fCurLang := ChangeFileExt(ExtractFileName(LangFile), '');

  fCurCodePage := GetCodePage(fCurLang); // <- Here
  devData.Language := ExtractFileName(LangFile);
end;
[MultiLangSupport.pas]

    Encodings: Array[0..MaxEncodings - 1] of TCPData =
    (
      ...
      //(CPID: 866; CPName: 'cp866'),
      //(CPID: 869; CPName: 'ibm869'),
      //(CPID: 870; CPName: 'IBM870'),
      //(CPID: 874; CPName: 'windows-874'),
      //(CPID: 875; CPName: 'cp875'),
      (CPID: 932; CPName: 'shift_jis'; CPLang: 'Japanese';), // <- Here
      (CPID: 936; CPName: 'gb2312'; CPLang: 'Chinese';),
      (CPID: 949; CPName: 'ks_c_5601-1987'; CPLang: 'Korean';),
      //(CPID: 950; CPName: 'big5'),
      //(CPID: 1026; CPName: 'IBM1026'),
      //(CPID: 1047; CPName: 'IBM01047'),
      //(CPID: 1140; CPName: 'IBM01140'),
      //(CPID: 1141; CPName: 'IBM01141'),
      ...

If Lang in the language file is changed to “Japanese”, garbled characters will not occur.

[lang]
Lang=日本語
Ver=1
1=ファイル(&F)
2=編集(&E)
...

[lang]
Lang=Japanese (日本語)
Ver=1
1=ファイル(&F)
2=編集(&E)
...

image

ht-deko added a commit to ht-deko/Dev-Cpp that referenced this issue May 23, 2024
Lang=Japanese (日本語) // Please see issue Embarcadero#297
Same number of items as English.lng.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant