Skip to content

Commit

Permalink
Feat: add french language (#2438)
Browse files Browse the repository at this point in the history
  • Loading branch information
lixun910 authored Jul 3, 2023
1 parent 0edb506 commit a5de089
Show file tree
Hide file tree
Showing 17 changed files with 6,380 additions and 22 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/osx_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
branches: [master]
paths-ignore:
- '**/README.md'
# Stop checking osx build on pull request, one has to check is manually
pull_request:
branches-ignore:
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/ubuntu_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
branches: [master]
paths-ignore:
- '**/README.md'
pull_request:
branches: [master]
paths-ignore:
- '**/README.md'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -114,3 +114,5 @@ internationalization/.vscode/settings.json
internationalization/~$zh_CN.xlsx

GeoDamake.opt
internationalization/credentials.json
internationalization/token.json
4 changes: 4 additions & 0 deletions BuildTools/macosx/code_sign.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,14 @@ def ProcessDependency(dylib_path, cid):
dylib_path = '/opt/homebrew/opt/icu4c/lib/libicuuc.71.dylib'
if dylib_path == '@loader_path/libicuuc.72.dylib':
dylib_path = '/opt/homebrew/opt/icu4c/lib/libicuuc.72.dylib'
if dylib_path == '@loader_path/libicuuc.73.dylib':
dylib_path = '/opt/homebrew/opt/icu4c/lib/libicuuc.73.dylib'
if dylib_path == '@loader_path/libicudata.71.dylib':
dylib_path = '/opt/homebrew/opt/icu4c/lib/libicudata.71.dylib'
if dylib_path == '@loader_path/libicudata.72.dylib':
dylib_path = '/opt/homebrew/opt/icu4c/lib/libicudata.72.dylib'
if dylib_path == '@loader_path/libicudata.73.dylib':
dylib_path = '/opt/homebrew/opt/icu4c/lib/libicudata.73.dylib'
if dylib_path == '@loader_path/libbrotlicommon.1.dylib':
dylib_path = '/opt/homebrew/opt/brotli/lib/libbrotlicommon.1.dylib'
if dylib_path == '@rpath/libsharpyuv.0.dylib':
Expand Down
4 changes: 4 additions & 0 deletions BuildTools/macosx/install_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,16 @@ def ProcessDependency(dir_path, dylib_name):
copyitem = '/usr/local/opt/icu4c/lib/libicuuc.71.dylib'
if item == '@loader_path/libicuuc.72.dylib':
copyitem = '/usr/local/opt/icu4c/lib/libicuuc.72.dylib'
if item == '@loader_path/libicuuc.73.dylib':
copyitem = '/usr/local/opt/icu4c/lib/libicuuc.73.dylib'
if item == '@loader_path/libicudata.70.dylib':
copyitem = '/usr/local/opt/icu4c/lib/libicudata.70.dylib'
if item == '@loader_path/libicudata.71.dylib':
copyitem = '/usr/local/opt/icu4c/lib/libicudata.71.dylib'
if item == '@loader_path/libicudata.72.dylib':
copyitem = '/usr/local/opt/icu4c/lib/libicudata.72.dylib'
if item == '@loader_path/libicudata.73.dylib':
copyitem = '/usr/local/opt/icu4c/lib/libicudata.73.dylib'
if item == '@loader_path/libbrotlicommon.1.dylib':
copyitem = '/usr/local/opt/brotli/lib/libbrotlicommon.1.dylib'
if item == '@rpath/libIlmThread-3_1.30.dylib':
Expand Down
6 changes: 6 additions & 0 deletions BuildTools/windows/installer/32bit/GeoDa-win7+.iss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"

[dirs]
Name: "{app}"; Check: InitializeSetup
Expand Down Expand Up @@ -202,6 +203,10 @@ begin
begin
langCode := '153'; // Portuguese
end;
5:
begin
langCode := '79'; // French
end;
end;
end;
Expand All @@ -228,6 +233,7 @@ begin
ComboBox.Items.Add('Spanish');
ComboBox.Items.Add('Russian');
ComboBox.Items.Add('Portuguese');
ComboBox.Items.Add('French');
ComboBox.ItemIndex := 0;
ComboBox.OnChange := @ComboBoxChange;
langCode := '58';
Expand Down
6 changes: 6 additions & 0 deletions BuildTools/windows/installer/32bit/GeoDa.iss
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Name: "en"; MessagesFile: "compiler:Default.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"

[dirs]
Name: "{app}"; Permissions: everyone-full; Check: InitializeSetup
Expand Down Expand Up @@ -201,6 +202,10 @@ begin
begin
langCode := '153'; // Portuguese
end;
5:
begin
langCode := '79'; // French
end;
end;
end;
Expand All @@ -227,6 +232,7 @@ begin
ComboBox.Items.Add('Spanish');
ComboBox.Items.Add('Russian');
ComboBox.Items.Add('Portuguese');
ComboBox.Items.Add('French');
ComboBox.ItemIndex := 0;
ComboBox.OnChange := @ComboBoxChange;
langCode := '58';
Expand Down
7 changes: 7 additions & 0 deletions BuildTools/windows/installer/64bit/GeoDa-win7+.iss
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ ShowLanguageDialog=yes

[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"

[dirs]
Name: "{app}"; Check: InitializeSetup
Expand Down Expand Up @@ -215,6 +217,10 @@ begin
begin
langCode := '153'; // Portuguese
end;
5:
begin
langCode := '79'; // French
end;
end;
end;
Expand All @@ -241,6 +247,7 @@ begin
ComboBox.Items.Add('Spanish');
ComboBox.Items.Add('Russian');
ComboBox.Items.Add('Portuguese');
ComboBox.Items.Add('French');
ComboBox.ItemIndex := 0;
ComboBox.OnChange := @ComboBoxChange;
langCode := '58';
Expand Down
6 changes: 6 additions & 0 deletions BuildTools/windows/installer/64bit/GeoDa.iss
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "spanish"; MessagesFile: "compiler:Languages\Spanish.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
Name: "portuguese"; MessagesFile: "compiler:Languages\Portuguese.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"

[dirs]
Name: "{app}"; Permissions: everyone-full; Check: InitializeSetup
Expand Down Expand Up @@ -214,6 +215,10 @@ begin
begin
langCode := '153'; // Portuguese
end;
5:
begin
langCode := '79'; // French
end;
end;
end;
Expand All @@ -240,6 +245,7 @@ begin
ComboBox.Items.Add('Spanish');
ComboBox.Items.Add('Russian');
ComboBox.Items.Add('Portuguese');
ComboBox.Items.Add('French');
ComboBox.ItemIndex := 0;
ComboBox.OnChange := @ComboBoxChange;
langCode := '58';
Expand Down
31 changes: 18 additions & 13 deletions DialogTools/PreferenceDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,14 @@ void PreferenceDlg::Init()
wxStaticText* lbl_txt113 = new wxStaticText(vis_page, wxID_ANY, lbl113);
cmb113 = new wxComboBox(vis_page, wxID_ANY, "", pos, wxDefaultSize, 0,
NULL, wxCB_READONLY);
cmb113->Append("");
cmb113->Append("English");
cmb113->Append("Chinese (Simplified)");
cmb113->Append("Spanish");
cmb113->Append("Russian");
cmb113->Append("Portuguese");
cmb113->Append(wxEmptyString);
cmb113->Append(GdaConst::gda_lang_chinese);
cmb113->Append(GdaConst::gda_lang_english);
cmb113->Append(GdaConst::gda_lang_french);
cmb113->Append(GdaConst::gda_lang_portuguese);
cmb113->Append(GdaConst::gda_lang_russian);
cmb113->Append(GdaConst::gda_lang_spanish);

cmb113->Bind(wxEVT_COMBOBOX, &PreferenceDlg::OnChooseLanguage, this);
//cmb113->Disable();

Expand Down Expand Up @@ -940,17 +942,20 @@ void PreferenceDlg::OnChooseLanguage(wxCommandEvent& ev)
wxConfigBase * config = new wxFileConfig("GeoDa", wxEmptyString, configPath);

if (lan_sel > 0) {
wxString sel_lan_name = cmb113->GetString(lan_sel);
long language = wxLANGUAGE_UNKNOWN;
if (lan_sel == 1) {
if (sel_lan_name == GdaConst::gda_lang_english) {
language = wxLANGUAGE_ENGLISH + 1;
} else if (lan_sel == 2) {
} else if (sel_lan_name == GdaConst::gda_lang_chinese) {
language = 45;//wxLANGUAGE_CHINESE + 1;
} else if (lan_sel == 3) {
} else if (sel_lan_name == GdaConst::gda_lang_spanish) {
language = 179;//wxLANGUAGE_SPANISH;
} else if (lan_sel == 4) {
language = wxLANGUAGE_RUSSIAN;
} else if (lan_sel == 5) {
language = wxLANGUAGE_PORTUGUESE;
} else if (sel_lan_name == GdaConst::gda_lang_russian) {
language = wxLANGUAGE_RUSSIAN; // 159
} else if (sel_lan_name == GdaConst::gda_lang_portuguese) {
language = wxLANGUAGE_PORTUGUESE; // 153
} else if (sel_lan_name == GdaConst::gda_lang_french) {
language = wxLANGUAGE_FRENCH; // 79
}
config->DeleteEntry("Translation");
config->SetPath("Translation");
Expand Down
7 changes: 7 additions & 0 deletions GdaConst.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,13 @@ const wxString GdaConst::gda_lbl_2sigma = "> 2Std";
const wxPen* GdaConst::default_myshape_pen=0;
const wxBrush* GdaConst::default_myshape_brush=0;

const wxString GdaConst::gda_lang_english = "English";
const wxString GdaConst::gda_lang_chinese = "Chinese (Simplified)";
const wxString GdaConst::gda_lang_french = "French";
const wxString GdaConst::gda_lang_portuguese = "Portuguese";
const wxString GdaConst::gda_lang_russian = "Russian";
const wxString GdaConst::gda_lang_spanish = "Spanish";

//background color -- this is light gray
const wxColour GdaConst::backColor(192, 192, 192);
// background color -- this is light gray
Expand Down
8 changes: 8 additions & 0 deletions GdaConst.h
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,14 @@ class GdaConst {
static const wxString gda_lbl_1sigma_2sigma;
static const wxString gda_lbl_2sigma;

// Languages
static const wxString gda_lang_english;
static const wxString gda_lang_chinese;
static const wxString gda_lang_french;
static const wxString gda_lang_portuguese;
static const wxString gda_lang_russian;
static const wxString gda_lang_spanish;

// Preferences
static double gda_autoweight_stop;
static bool gda_draw_map_labels;
Expand Down
13 changes: 6 additions & 7 deletions internationalization/google_sheets_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import pickle
import os.path
import argparse
from google.oauth2.credentials import Credentials
from googleapiclient.discovery import build
from google_auth_oauthlib.flow import InstalledAppFlow
from google.auth.transport.requests import Request
Expand All @@ -23,21 +24,19 @@ def google_get_creds():
# The file token.pickle stores the user's access and refresh tokens, and is
# created automatically when the authorization flow completes for the first
# time.
if os.path.exists('token.pickle'):
with open('token.pickle', 'rb') as token:
creds = pickle.load(token)
if os.path.exists('token.json'):
creds = Credentials.from_authorized_user_file('token.json', SCOPES)
# If there are no (valid) credentials available, let the user log in.
if not creds or not creds.valid:
if creds and creds.expired and creds.refresh_token:
creds.refresh(Request())
else:
flow = InstalledAppFlow.from_client_secrets_file(
'credentials.json', SCOPES)
creds = flow.run_local_server()
creds = flow.run_local_server(port=0)
# Save the credentials for the next run
with open('token.pickle', 'wb') as token:
pickle.dump(creds, token)

with open('token.json', 'w', encoding='utf8') as token:
token.write(creds.to_json())
return creds

def google_get_po_items(locale_code):
Expand Down
Binary file added internationalization/lang/fr/GeoDa.mo
Binary file not shown.
Loading

0 comments on commit a5de089

Please sign in to comment.