[Notes][Translate] Added Code to support translating UI to other langs

pull/812/head
Peter Goodhall 2021-01-11 15:22:48 +00:00
rodzic fba3a16ecc
commit f507acde67
6 zmienionych plików z 56 dodań i 30 usunięć

Wyświetl plik

@ -8,6 +8,9 @@ class Notes extends CI_Controller {
$this->load->model('user_model');
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
// Load language files
$this->lang->load('notes');
}

Wyświetl plik

@ -0,0 +1,23 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
$lang['notes_menu_notes'] = 'Notes';
$lang['notes_edit_note'] = 'Edit Note';
$lang['notes_your_notes'] = 'Your Notes';
$lang['notes_welcome'] = "You don't currently have any notes, these are a fantastic way of storing data like ATU settings, beacons and general station notes and its better than paper as you can't lose them!";
$lang['notes_create_note'] = 'Create Note';
$lang['notes_input_title'] = 'Title';
$lang['notes_input_category'] = 'Category';
$lang['notes_input_notes_content'] = 'Note Contents';
$lang['notes_input_btn_save_note'] = 'Save Note';
$lang['notes_input_btn_edit_note'] = 'Edit Note';
$lang['notes_input_btn_delete_note'] = 'Delete Note';
$lang['notes_selection_general'] = 'General';
$lang['notes_selection_antennas'] = 'Antennas';
$lang['notes_selection_satellites'] = 'Satellites';

Wyświetl plik

@ -3,13 +3,13 @@
<div class="card">
<div class="card-header">
<h2 class="card-title">Create Note</h2>
<h2 class="card-title"><?php echo $this->lang->line('notes_create_note'); ?></h2>
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('notes'); ?>">Notes</a>
<a class="nav-link" href="<?php echo site_url('notes'); ?>"><?php echo $this->lang->line('notes_menu_notes'); ?></a>
</li>
<li class="nav-item">
<a class="nav-link active" href="<?php echo site_url('notes/add'); ?>">Create Note</a>
<a class="nav-link active" href="<?php echo site_url('notes/add'); ?>"><?php echo $this->lang->line('notes_create_note'); ?></a>
</li>
</ul>
</div>
@ -26,26 +26,26 @@
<form method="post" action="<?php echo site_url('notes/add'); ?>" name="notes_add" id="notes_add">
<div class="form-group">
<label for="inputTitle">Title</label>
<label for="inputTitle"><?php echo $this->lang->line('notes_input_title'); ?></label>
<input type="text" name="title" class="form-control" id="inputTitle">
</div>
<div class="form-group">
<label for="catSelect">Category</label>
<label for="catSelect"><?php echo $this->lang->line('notes_input_category'); ?></label>
<select name="category" class="form-control" id="catSelect">
<option value="General" selected="selected">General</option>
<option value="Antennas">Antennas</option>
<option value="Satellites">Satellites</option>
<option value="General" selected="selected"><?php echo $this->lang->line('notes_selection_general'); ?></option>
<option value="Antennas"><?php echo $this->lang->line('notes_selection_antennas'); ?></option>
<option value="Satellites"><?php echo $this->lang->line('notes_selection_satellites'); ?></option>
</select>
</div>
<div class="form-group">
<label for="inputTitle">Note Contents</label>
<label for="inputTitle"><?php echo $this->lang->line('notes_input_notes_content'); ?></label>
<div id="quillArea"></div>
<textarea name="content" style="display:none" id="hiddenArea"></textarea>
</div>
<button type="submit" value="Submit" class="btn btn-primary">Save Note</button>
<button type="submit" value="Submit" class="btn btn-primary"><?php echo $this->lang->line('notes_input_btn_save_note'); ?></button>
</form>
</div>
</div>

Wyświetl plik

@ -4,13 +4,13 @@
<?php foreach ($note->result() as $row) { ?>
<div class="card">
<div class="card-header">
<h2 class="card-title">Edit Note</h2>
<h2 class="card-title"><?php echo $this->lang->line('notes_edit_note'); ?></h2>
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('notes'); ?>">Notes</a>
<a class="nav-link" href="<?php echo site_url('notes'); ?>"><?php echo $this->lang->line('notes_menu_notes'); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('notes/add'); ?>">Create Note</a>
<a class="nav-link" href="<?php echo site_url('notes/add'); ?>"><?php echo $this->lang->line('notes_create_note'); ?></a>
</li>
</ul>
</div>
@ -27,27 +27,27 @@
<form method="post" action="<?php echo site_url('notes/edit'); ?>/<?php echo $id; ?>" name="notes_add" id="notes_add">
<div class="form-group">
<label for="inputTitle">Title</label>
<label for="inputTitle"><?php echo $this->lang->line('notes_input_title'); ?></label>
<input type="text" name="title" class="form-control" value="<?php echo $row->title; ?>" id="inputTitle">
</div>
<div class="form-group">
<label for="catSelect">Category</label>
<label for="catSelect"><?php echo $this->lang->line('notes_input_category'); ?></label>
<select name="category" class="form-control" id="catSelect">
<option value="General" selected="selected">General</option>
<option value="Antennas">Antennas</option>
<option value="Satellites">Satellites</option>
<option value="General" selected="selected"><?php echo $this->lang->line('notes_selection_general'); ?></option>
<option value="Antennas"><?php echo $this->lang->line('notes_selection_antennas'); ?></option>
<option value="Satellites"><?php echo $this->lang->line('notes_selection_satellites'); ?></option>
</select>
</div>
<div class="form-group">
<label for="inputTitle">Note Contents</label>
<label for="inputTitle"><?php echo $this->lang->line('notes_input_notes_content'); ?></label>
<div id="quillArea"><?php echo $row->note; ?></div>
<textarea name="content" style="display:none" id="hiddenArea"></textarea>
</div>
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<button type="submit" value="Submit" class="btn btn-primary">Save Note</button>
<button type="submit" value="Submit" class="btn btn-primary"><?php echo $this->lang->line('notes_input_btn_save_note'); ?></button>
</form>
</div>

Wyświetl plik

@ -2,13 +2,13 @@
<div class="card">
<div class="card-header">
<h2 class="card-title">Notes</h2>
<h2 class="card-title"><?php echo $this->lang->line('notes_menu_notes'); ?></h2>
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link active" href="<?php echo site_url('notes'); ?>">Notes</a>
<a class="nav-link active" href="<?php echo site_url('notes'); ?>"><?php echo $this->lang->line('notes_menu_notes'); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('notes/add'); ?>">Create Note</a>
<a class="nav-link" href="<?php echo site_url('notes/add'); ?>"><?php echo $this->lang->line('notes_create_note'); ?></a>
</li>
</ul>
</div>
@ -19,7 +19,7 @@
if ($notes->num_rows() > 0)
{
echo "<h3>Your Notes</h3>";
echo "<h3>".$this->lang->line('notes_your_notes')."</h3>";
echo "<ul class=\"list-group\">";
foreach ($notes->result() as $row)
{
@ -29,7 +29,7 @@
}
echo "</ul>";
} else {
echo "<p>You don't currently have any notes, these are a fantastic way of storing data like ATU settings, beacons and general station notes and its better than paper as you can't lose them!</p>";
echo "<p>".$this->lang->line('notes_welcome')."</p>";
}
?>

Wyświetl plik

@ -3,22 +3,22 @@
<div class="card">
<?php foreach ($note->result() as $row) { ?>
<div class="card-header">
<h2 class="card-title">Note - <?php echo $row->title; ?></h2>
<h2 class="card-title"><?php echo $this->lang->line('notes_menu_notes'); ?> - <?php echo $row->title; ?></h2>
<ul class="nav nav-tabs card-header-tabs">
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('notes'); ?>">Notes</a>
<a class="nav-link" href="<?php echo site_url('notes'); ?>"><?php echo $this->lang->line('notes_menu_notes'); ?></a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?php echo site_url('notes/add'); ?>">Create Note</a>
<a class="nav-link" href="<?php echo site_url('notes/add'); ?>"><?php echo $this->lang->line('notes_create_note'); ?></a>
</li>
</ul>
</div>
<div class="card-body">
<p class="card-text"><?php echo nl2br($row->note); ?></p>
<a href="<?php echo site_url('notes/edit'); ?>/<?php echo $row->id; ?>" class="btn btn-primary"><i class="fas fa-edit"></i> Edit Note</a>
<a href="<?php echo site_url('notes/edit'); ?>/<?php echo $row->id; ?>" class="btn btn-primary"><i class="fas fa-edit"></i> <?php echo $this->lang->line('notes_input_btn_edit_note'); ?></a>
<a href="<?php echo site_url('notes/delete'); ?>/<?php echo $row->id; ?>" class="btn btn-danger"><i class="fas fa-trash-alt"></i> Delete Note</a>
<a href="<?php echo site_url('notes/delete'); ?>/<?php echo $row->id; ?>" class="btn btn-danger"><i class="fas fa-trash-alt"></i> <?php echo $this->lang->line('notes_input_btn_delete_note'); ?></a>
<?php } ?>
</div
> </div>