Skip to content

Gettext PR #2 #456

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

Merged
merged 22 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
35 changes: 0 additions & 35 deletions application/config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,41 +82,6 @@

$autoload['config'] = array('wavelog', 'bands', 'lotw', 'gettext');


/*
| -------------------------------------------------------------------
| Auto-load Language files
| -------------------------------------------------------------------
| Prototype:
|
| $autoload['language'] = array('lang1', 'lang2');
|
| NOTE: Do not include the "_lang" part of your file. For example
| "codeigniter_lang.php" would be referenced as array('codeigniter');
|
*/

$autoload['language'] = array(
'account',
'adif',
'admin',
'awards',
'contesting',
'eqsl',
'export',
'filter',
'general_words',
'gridsquares',
'lotw',
'menu',
'notes',
'options',
'qslcard',
'qso',
'station',
'statistics'
);

/*
| -------------------------------------------------------------------
| Auto-load Models
Expand Down
112 changes: 56 additions & 56 deletions application/config/config.sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,69 +143,69 @@

/*
|--------------------------------------------------------------------------
| Default Language
| Default Language DEPRECATED! NOT IN USE ANYMORE!
|--------------------------------------------------------------------------
|
| This determines which set of language files should be used. Make sure
| there is an available translation if you intend to use something other
| than english.
|
*/
$lang = 'english'; // this language will be used per default

if (isset($_COOKIE["language"])) {
$tmp_value = $_COOKIE["language"];
if (!empty($tmp_value)) { $lang = $tmp_value; }
}
switch ($lang) { // do this for security-reasons! parse only langs, which are known to us
case 'dutch':
$config['language'] = $lang;
break;
case 'chinese_simplified':
$config['language'] = $lang;
break;
case 'spanish':
$config['language'] = $lang;
break;
case 'czech':
$config['language'] = $lang;
break;
case 'bulgarian':
$config['language'] = $lang;
break;
case 'turkish':
$config['language'] = $lang;
break;
case 'swedish':
$config['language'] = $lang;
break;
case 'polish':
$config['language'] = $lang;
break;
case 'italian':
$config['language'] = $lang;
break;
case 'greek':
$config['language'] = $lang;
break;
case 'french':
$config['language'] = $lang;
break;
case 'finnish':
$config['language'] = $lang;
break;
case 'russian':
$config['language'] = $lang;
break;
case 'english':
$config['language'] = $lang;
break;
case 'german':
$config['language'] = $lang;
break;
}

$config['cl_multilanguage']=true;
// $lang = 'english'; // this language will be used per default

// if (isset($_COOKIE["language"])) {
// $tmp_value = $_COOKIE["language"];
// if (!empty($tmp_value)) { $lang = $tmp_value; }
// }
// switch ($lang) { // do this for security-reasons! parse only langs, which are known to us
// case 'dutch':
// $config['language'] = $lang;
// break;
// case 'chinese_simplified':
// $config['language'] = $lang;
// break;
// case 'spanish':
// $config['language'] = $lang;
// break;
// case 'czech':
// $config['language'] = $lang;
// break;
// case 'bulgarian':
// $config['language'] = $lang;
// break;
// case 'turkish':
// $config['language'] = $lang;
// break;
// case 'swedish':
// $config['language'] = $lang;
// break;
// case 'polish':
// $config['language'] = $lang;
// break;
// case 'italian':
// $config['language'] = $lang;
// break;
// case 'greek':
// $config['language'] = $lang;
// break;
// case 'french':
// $config['language'] = $lang;
// break;
// case 'finnish':
// $config['language'] = $lang;
// break;
// case 'russian':
// $config['language'] = $lang;
// break;
// case 'english':
// $config['language'] = $lang;
// break;
// case 'german':
// $config['language'] = $lang;
// break;
// }

// $config['cl_multilanguage']=true;

/*
|--------------------------------------------------------------------------
Expand Down
3 changes: 3 additions & 0 deletions application/config/gettext.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@
| -------------------------------------------------------------------
| A list of enabled languages. These are the language that will be
| used on the site.
|
| IMPORTANT: If you add new languages also add this at the end of application/views/debug/index.php
|
*/
$config['languages'] = array(

Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Accumulated.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ function __construct()
public function index()
{
// Render Page
$data['page_title'] = $this->lang->line('menu_accumulated_statistics');
$data['page_title'] = __("Accumulated Statistics");

$this->load->model('bands');

Expand Down
10 changes: 5 additions & 5 deletions application/controllers/Activated_gridmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function __construct() {
}

public function index() {
$data['page_title'] = "Activated Gridsquare Map";
$data['page_title'] = __("Activated Gridsquare Map");

$this->load->model('bands');
$this->load->model('activated_gridmap_model');
Expand All @@ -28,10 +28,10 @@ public function index() {

$data['attribution'] = $this->optionslib->get_option('option_map_tile_server_copyright');

$data['gridsquares_gridsquares'] = lang('gridsquares_gridsquares');
$data['gridsquares_gridsquares_confirmed'] = lang('gridsquares_gridsquares_confirmed');
$data['gridsquares_gridsquares_not_confirmed'] = lang('gridsquares_gridsquares_not_confirmed');
$data['gridsquares_gridsquares_total_activated'] = lang('gridsquares_gridsquares_total_activated');
$data['gridsquares_gridsquares'] = __("Gridsquares");
$data['gridsquares_gridsquares_confirmed'] = __("Gridsquares confirmed");
$data['gridsquares_gridsquares_not_confirmed'] = __("Gridsquares not confirmed");
$data['gridsquares_gridsquares_total_activated'] = __("Total gridsquares activated");

$footerData = [];
$footerData['scripts'] = [
Expand Down
16 changes: 8 additions & 8 deletions application/controllers/Awards.php
Original file line number Diff line number Diff line change
Expand Up @@ -892,10 +892,10 @@ public function gridmaster($dxcc) {

$data['attribution']= $this->optionslib->get_option('option_map_tile_server_copyright');

$data['gridsquares_gridsquares']= lang('gridsquares_gridsquares');
$data['gridsquares_gridsquares_worked']= lang('gridsquares_gridsquares_worked');
$data['gridsquares_gridsquares_lotw']= lang('gridsquares_gridsquares_lotw');
$data['gridsquares_gridsquares_paper']= lang('gridsquares_gridsquares_paper');
$data['gridsquares_gridsquares']= __("Gridsquares");
$data['gridsquares_gridsquares_worked']= __("Gridsquares worked");
$data['gridsquares_gridsquares_lotw']= __("Gridsquares confirmed on LoTW");
$data['gridsquares_gridsquares_paper']= __("Gridsquares confirmed by paper QSL");

$indexData['dxcc'] = $dxcc;

Expand Down Expand Up @@ -924,10 +924,10 @@ public function ffma() {

$data['attribution']= $this->optionslib->get_option('option_map_tile_server_copyright');

$data['gridsquares_gridsquares']= lang('gridsquares_gridsquares');
$data['gridsquares_gridsquares_worked']= lang('gridsquares_gridsquares_worked');
$data['gridsquares_gridsquares_lotw']= lang('gridsquares_gridsquares_lotw');
$data['gridsquares_gridsquares_paper']= lang('gridsquares_gridsquares_paper');
$data['gridsquares_gridsquares']= __("Gridsquares");
$data['gridsquares_gridsquares_worked']= __("Gridsquares worked");
$data['gridsquares_gridsquares_lotw']= __("Gridsquares confirmed on LoTW");
$data['gridsquares_gridsquares_paper']= __("Gridsquares confirmed by paper QSL");
$data['grid_count'] = $this->ffma_model->get_grid_count();
$data['grids'] = $this->ffma_model->get_grids();

Expand Down
4 changes: 2 additions & 2 deletions application/controllers/Contesting.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function add() {
$data['contests'] = $this->Contesting_model->getAllContests();

// Render Page
$data['page_title'] = "Contests";
$data['page_title'] = __("Contests");
$this->load->view('interface_assets/header', $data);
$this->load->view('contesting/add');
$this->load->view('interface_assets/footer');
Expand All @@ -110,7 +110,7 @@ public function edit($id) {

$data['contest'] = $this->Contesting_model->contest($item_id_clean);

$data['page_title'] = lang('admin_contest_edit_update_contest');
$data['page_title'] = __("Update Contest");

$this->form_validation->set_rules('name', 'Contest Name', 'required');
$this->form_validation->set_rules('adifname', 'Adif Contest Name', 'required');
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Dayswithqso.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function index()
{
$this->load->model('dayswithqso_model');
// Render Page
$data['page_title'] = lang('statistics_days_with_qso');
$data['page_title'] = __("Number of days with QSOs each year");

$data['result'] = $this->dayswithqso_model->getDaysWithQso();
$data['streaks'] = $this->dayswithqso_model->getLongestStreak();
Expand Down
1 change: 1 addition & 0 deletions application/controllers/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public function index() {
$data['stations'] = $this->Stations->all();

$data['qso_total'] = $this->Debug_model->count_all_qso();
$data['available_languages'] = $this->config->item('languages');

$data['qsos_with_no_station_id'] = $this->Logbook_model->check_for_station_id();
if ($data['qsos_with_no_station_id']) {
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/Distances.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function getDistanceQsos(){

// Render Page
$data['page_title'] = "Log View - " . $distance;
$data['filter'] = lang('statistics_distances_qsos_with') . " " . $distance . " " . lang('statistics_distances_and_band'). " " . $band;
$data['filter'] = __("QSOs with") . " " . $distance . " " . __("and band"). " " . $band;
$this->load->view('awards/details', $data);
}
}
10 changes: 5 additions & 5 deletions application/controllers/Gridmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ function __construct() {
}

public function index() {
$data['page_title'] = lang('gridsquares_gridsquare_map');
$data['page_title'] = __("Gridsquare Map");

$this->load->model('bands');
$this->load->model('gridmap_model');
Expand All @@ -28,10 +28,10 @@ public function index() {

$data['attribution'] = $this->optionslib->get_option('option_map_tile_server_copyright');

$data['gridsquares_gridsquares'] = lang('gridsquares_gridsquares');
$data['gridsquares_gridsquares_confirmed'] = lang('gridsquares_gridsquares_confirmed');
$data['gridsquares_gridsquares_not_confirmed'] = lang('gridsquares_gridsquares_not_confirmed');
$data['gridsquares_gridsquares_total_worked'] = lang('gridsquares_gridsquares_total_worked');
$data['gridsquares_gridsquares'] = __("Gridsquares");
$data['gridsquares_gridsquares_confirmed'] = __("Gridsquares confirmed");
$data['gridsquares_gridsquares_not_confirmed'] = __("Gridsquares not confirmed");
$data['gridsquares_gridsquares_total_worked'] = __("Total gridsquares worked");

$footerData = [];
$footerData['scripts'] = [
Expand Down
40 changes: 20 additions & 20 deletions application/controllers/Logbook.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function index()
$data['user_map_custom'] = $this->optionslib->get_map_custom();

if(!$data['results']) {
$this->session->set_flashdata('notice', lang('error_no_logbook_found') . ' <a href="' . site_url('logbooks') . '" title="Station Logbooks">Station Logbooks</a>');
$this->session->set_flashdata('notice', __("No logbooks were found. You need to define a logbook under Station Logbooks! Do it here:") . ' <a href="' . site_url('logbooks') . '" title="Station Logbooks">' . __('Station Logbooks') . '</a>');
}

// Calculate Lat/Lng from Locator to use on Maps
Expand Down Expand Up @@ -664,13 +664,13 @@ function partial($id, $band = null) {
$html .= $this->part_table_header_col($this, $this->session->userdata('user_column4')==""?'Band':$this->session->userdata('user_column4'));
switch($this->session->userdata('user_previous_qsl_type')) {
case 0:
$html .= "<th>".lang('gen_hamradio_qsl')."</th>";
$html .= "<th>".__("QSL")."</th>";
break;
case 1:
$html .= "<th>".lang('lotw_short')."</th>";
$html .= "<th>".__("LoTW")."</th>";
break;
case 2:
$html .= "<th>".lang('eqsl_short')."</th>";
$html .= "<th>".__("eQSL")."</th>";
break;
case 4:
$html .= "<th>QRZ</th>";
Expand All @@ -679,7 +679,7 @@ function partial($id, $band = null) {
$html .= "<th>Clublog</th>";
break;
default:
$html .= "<th>".lang('gen_hamradio_qsl')."</th>";
$html .= "<th>".__("QSL")."</th>";
break;
}
$html .= "<th></th>";
Expand Down Expand Up @@ -1272,20 +1272,20 @@ function get_qsos($num, $offset) {
function part_table_header_col($ctx, $name) {
$ret='';
switch($name) {
case 'Mode': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_mode').'</th>'; break;
case 'RSTS': $ret.= '<th class="d-none d-sm-table-cell">'.$ctx->lang->line('gen_hamradio_rsts').'</th>'; break;
case 'RSTR': $ret.= '<th class="d-none d-sm-table-cell">'.$ctx->lang->line('gen_hamradio_rstr').'</th>'; break;
case 'Country': $ret.= '<th>'.$ctx->lang->line('general_word_country').'</th>'; break;
case 'IOTA': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_iota').'</th>'; break;
case 'SOTA': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_sota').'</th>'; break;
case 'WWFF': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_wwff').'</th>'; break;
case 'POTA': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_pota').'</th>'; break;
case 'State': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_state').'</th>'; break;
case 'Grid': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_gridsquare').'</th>'; break;
case 'Distance': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_distance').'</th>'; break;
case 'Band': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_band').'</th>'; break;
case 'Frequency': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_frequency').'</th>'; break;
case 'Operator': $ret.= '<th>'.$ctx->lang->line('gen_hamradio_operator').'</th>'; break;
case 'Mode': $ret.= '<th>'.__("Mode").'</th>'; break;
case 'RSTS': $ret.= '<th class="d-none d-sm-table-cell">'.__("RST (S)").'</th>'; break;
case 'RSTR': $ret.= '<th class="d-none d-sm-table-cell">'.__("RST (R)").'</th>'; break;
case 'Country': $ret.= '<th>'.__("Country").'</th>'; break;
case 'IOTA': $ret.= '<th>'.__("IOTA").'</th>'; break;
case 'SOTA': $ret.= '<th>'.__("SOTA").'</th>'; break;
case 'WWFF': $ret.= '<th>'.__("WWFF").'</th>'; break;
case 'POTA': $ret.= '<th>'.__("POTA").'</th>'; break;
case 'State': $ret.= '<th>'.__("State").'</th>'; break;
case 'Grid': $ret.= '<th>'.__("Gridsquare").'</th>'; break;
case 'Distance': $ret.= '<th>'.__("Distance").'</th>'; break;
case 'Band': $ret.= '<th>'.__("Band").'</th>'; break;
case 'Frequency': $ret.= '<th>'.__("Frequency").'</th>'; break;
case 'Operator': $ret.= '<th>'.__("Operator").'</th>'; break;
}
return $ret;
}
Expand All @@ -1307,7 +1307,7 @@ function part_table_col($row, $name) {
case 'Mode': $ret.= '<td>'; $ret.= $row->COL_SUBMODE==null?$row->COL_MODE:$row->COL_SUBMODE . '</td>'; break;
case 'RSTS': $ret.= '<td class="d-none d-sm-table-cell">' . $row->COL_RST_SENT; if ($row->COL_STX) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">'; $ret.=sprintf("%03d", $row->COL_STX); $ret.= '</span>';} if ($row->COL_STX_STRING) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">' . $row->COL_STX_STRING . '</span>';} $ret.= '</td>'; break;
case 'RSTR': $ret.= '<td class="d-none d-sm-table-cell">' . $row->COL_RST_RCVD; if ($row->COL_SRX) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">'; $ret.=sprintf("%03d", $row->COL_SRX); $ret.= '</span>';} if ($row->COL_SRX_STRING) { $ret.= ' <span data-bs-toggle="tooltip" title="'.($row->COL_CONTEST_ID!=""?$row->COL_CONTEST_ID:"n/a").'" class="badge text-bg-light">' . $row->COL_SRX_STRING . '</span>';} $ret.= '</td>'; break;
case 'Country': $ret.= '<td>' . ucwords(strtolower(($row->COL_COUNTRY ?? ''))); if ($row->end ?? '' != '') $ret.= ' <span class="badge text-bg-danger">'.$ci->lang->line('gen_hamradio_deleted_dxcc').'</span>' . '</td>'; break;
case 'Country': $ret.= '<td>' . ucwords(strtolower(($row->COL_COUNTRY ?? ''))); if ($row->end ?? '' != '') $ret.= ' <span class="badge text-bg-danger">'.__("Deleted DXCC").'</span>' . '</td>'; break;
case 'IOTA': $ret.= '<td>' . ($row->COL_IOTA) . '</td>'; break;
case 'SOTA': $ret.= '<td>' . ($row->COL_SOTA_REF) . '</td>'; break;
case 'WWFF': $ret.= '<td>' . ($row->COL_WWFF_REF) . '</td>'; break;
Expand Down
Loading