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

FALTA TERMINAR, implementando multilenguaje #17

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .gitignore
Empty file.
5 changes: 3 additions & 2 deletions includes/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
|--------------------------------------------------------------------------
*/
define( 'DB_HOST', 'localhost' ); // Set database host
define( 'DB_USER', 'webuser' ); // Set database user
define( 'DB_PASS', 'p1r4sp' ); // Set database password
define( 'DB_USER', 'root' ); // Set database user
define( 'DB_PASS', '' ); // Set database password
define( 'DB_NAME', 'inventory' ); // Set database name
define( 'APP_LANG', 'es'); //Set language of app

?>
27 changes: 27 additions & 0 deletions includes/language.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

class Language {
private $lang_content;
private $lang_folder;

function __construct($lang_folder, $lang_content = ''){
$this->lang_folder = $lang_folder;
$this->lang_content = $lang_content;

}

public function set($lang_content) {
$this->lang_content = $lang_content;
}

public function get($var) {
$lang = $this->load_lang_content();
echo $lang[$var];
}

private function load_lang_content() {
include($this->lang_folder.DIRECTORY_SEPARATOR.$this->lang_content);
return $lang;
}
}
?>
2 changes: 2 additions & 0 deletions includes/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
require_once LIB_PATH_INC.'database.php';
require_once LIB_PATH_INC.'sql.php';
require_once LIB_PATH_INC.'formatcurrency.php';
require_once LIB_PATH_INC.'language.php';

$lang = new Language('..'.DS.'language'.DS.APP_LANG);
/*--------------------------------------------------------------*/
/* Change format of currency used throughout the system
/*--------------------------------------------------------------*/
Expand Down
Empty file added language/es/common.php
Empty file.
Empty file added language/es/customers.php
Empty file.
Empty file added language/es/products.php
Empty file.
Empty file added language/es/reports.php
Empty file.
Empty file added language/es/sales.php
Empty file.
Empty file added language/es/uploads.php
Empty file.
88 changes: 88 additions & 0 deletions language/es/users.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
<?php
// Translate Leo Galindo [https://github.io/jleog/]
$lang = array(

// File add_group.php
'ADD_NEW_USER_GROUP' => 'Añadir nuevo usuario:',

'NAME_GROUP_NO_DATABASE' => '<b>¡Lo siento!</b> El nombre del grupo no está en la base de datos!',
'LEVEL_GROUP_NO_DATABASE' => '<b>¡Lo siento!</b> El nivel del grupo no está en la base de datos!',
'GROUP_BEEN_CREATE' => '¡El grupo ha sido creado!',
'GRUP_NO_CREATE' => '¡Lo siento! El grupo no fué creado.',

'GROUP_NAME' => 'Nombre del grupo',
'GROUP_LEVEL' => 'Nivel del grupo',

'STATUS_NAME' => 'Estado',
'STATUS_ACTIVE' => 'Activo',
'STATUS_DESACTIVE' => 'Inactivo',

'UPDATE_NAME' => 'Actualizar',

// File add_user.php
'USER_USED' => '¡Lo siento! El usuario ya esta en uso.',
'ACCOUNT_CREATE' => 'Su cuenta ha sido creada.',
'ACCOUNT_NO_CREATE' => '¡Lo siento! Su cuenta no ha sido creada.',

'ADD_NEW_USER' => 'Añadir usuario.',
'ACCOUNT_NAME' => 'Nombre',
'ACCOUNT_USERNAME' => 'Nombre de usuario',
'ACCOUNT_PASSWORD' => 'Contraseña',
'ACCOUNT_USERROLE' => 'Rol de usuario',

// File admin.php
'ADMIN_TITLE' => 'Administración del sitio',

'CUSTOMER_NAME' => 'Clientes',
'CAT_NAME' => 'Categorías',
'PRODUCTS_NAME' => 'Productos',
'SALES_NAME' => 'Ventas',

'WELCOME_SUPPORT_ADDITIONAL' => '¡Bienvenido! Para información adicional por favor contacte a soporte técnico.',

'HIGHEST_SELLING_PRODUCTS' => 'Productos más vendidos',
'TOTAL_SOLD' => 'Total vendido (productos)',
'TOTAL_QUANTY' => 'Total vendido (dinero)',

'LATEST_SALES' => 'Ultimas ventas',
'DATE_NAME' => 'Fecha',
'TOTAL_SALE' => 'Venta total',

'RECENTLY_ADDLE_PRODUCTS' => 'Productos añadidos recientemente.',

//File auth.php

'WELCOME_TO_APP' => 'Bienvenido a Inventory',
'USERNAME_OR_PASS_INCORRECT' => '¡Lo siento! Usuario o contraseña incorrecta',

//File change_password.php
'TITLE_CHANGE_PASS' => 'Cambiar contraseña',

'OLD_PASS_NO_MATCH' => 'Contraseña incorrecta',
'LOGIN_NEW_PASS' => 'Inicia sesión con tu nueva contraseña',
'FAILED_UPDATE' => '¡Lo siento! La actualización de tus datos ha fallado',

'CHANGE_PASS'| => 'Cambiar contraseña',
'NEW_PASS' => 'Contraseña nueva',
'OLD_PASS' => 'Contraseña antigüa',
'CHANGE_NAME' => 'Cambiar',

//File delete_group.php
'GROUP_DELETED' => 'El grupo ha sido eliminado',
'GROUP_NO_DELETED' => 'Error al eliminar el grupo o no existe',

//File delete_log_by_ip.php
'LOG_DELETED' => 'Log eliminado',
'LOG_NO_DELETED' => 'Error al eliminar el Log',
'LOG_NO_FOUND' => 'No se encontró el log con el identificador establecido'

/*
* TERMINAR DE TRADUCIR LOS ARCHIVOS FALTANTES Y RESPETAR EL ORDEN QUE LLEVO
* TO COMPLETE OF TRANSLATE MISSING FILES AND RESPECT THE ORDER
*/



);

?>
24 changes: 14 additions & 10 deletions users/add_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,12 @@

$page_title = 'Add Group';
require_once '../includes/load.php';

// Setting language var
$lang->set('users.php');

// Checkin What level user has permission to view this page
page_require_level(1);
page_require_level(1);
?>
<?php
if (isset($_POST['add'])) {
Expand All @@ -36,11 +40,11 @@
$query .=")";
if ($db->query($query)) {
//sucess
$session->msg('s', "Group has been creted! ");
$session->msg('s', $lang->get('NAME_GROUP_NO_DATABASE'));
redirect('../users/add_group.php', false);
} else {
//failed
$session->msg('d', ' Sorry failed to create Group!');
$session->msg('d', $lang->get('LEVEL_GROUP_NO_DATABASE'));
redirect('../users/add_group.php', false);
}
} else {
Expand All @@ -52,27 +56,27 @@
<?php include_once '../layouts/header.php'; ?>
<div class="login-page">
<div class="text-center">
<h3>Add new user Group</h3>
<h3><?php echo $lang->get('ADD_NEW_USER_GROUP') ?></h3>
</div>
<?php echo display_msg($msg); ?>
<form method="post" action="../users/add_group.php" class="clearfix">
<div class="form-group">
<label for="name" class="control-label">Group Name</label>
<label for="name" class="control-label"><?php echo $lang->get('GROUP_NAME') ?></label>
<input type="name" class="form-control" name="group-name">
</div>
<div class="form-group">
<label for="level" class="control-label">Group Level</label>
<label for="level" class="control-label"><?php echo $lang->get('GROUP_LEVEL') ?></label>
<input type="number" class="form-control" name="group-level">
</div>
<div class="form-group">
<label for="status">Status</label>
<label for="status"><?php echo $lang->get('STATUS_NAME') ?></label>
<select class="form-control" name="status">
<option value="1">Active</option>
<option value="0">Deactive</option>
<option value="1"><?php echo $lang->get('STATUS_ACTIVE') ?></option>
<option value="0"><?php echo $lang->get('STATUS_DESACTIVE') ?></option>
</select>
</div>
<div class="form-group clearfix">
<button type="submit" name="add" class="btn btn-info">Update</button>
<button type="submit" name="add" class="btn btn-info"><?php echo $lang->get('UPDATE_NAME') ?></button>
</div>
</form>
</div>
Expand Down
4 changes: 4 additions & 0 deletions users/add_user.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

$page_title = 'Add User';
require_once '../includes/load.php';

// Setting language var
$lang->set('users.php');

// Checkin What level user has permission to view this page
page_require_level(1);

Expand Down
3 changes: 3 additions & 0 deletions users/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
$page_title = 'Admin Home Page';
require_once '../includes/load.php';

// Setting language var
$lang->set('users.php');

page_require_level(1);

$c_categories = count_by_id('categories');
Expand Down
3 changes: 3 additions & 0 deletions users/auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@

include_once '../includes/load.php';

// Setting language var
$lang->set('users.php');

$req_fields = array('username', 'password' );
validate_fields($req_fields);
$username = remove_junk($_POST['username']);
Expand Down
4 changes: 4 additions & 0 deletions users/change_password.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@

$page_title = 'Change Password';
require_once '../includes/load.php';

// Setting language var
$lang->set('users.php');

// Checkin What level user has permission to view this page
page_require_level(3);
?>
Expand Down
4 changes: 4 additions & 0 deletions users/delete_group.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@


require_once '../includes/load.php';

// Setting language var
$lang->set('users.php');

// Checkin What level user has permission to view this page
page_require_level(1);
?>
Expand Down
4 changes: 4 additions & 0 deletions users/delete_log_by_ip.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
// Checkin What level user has permission to view this page
page_require_level(2);

// Setting language var
$lang->set('users.php');


if ( isset($_GET['ip']) ) {
$remote_ip = filter_var($_GET['ip'], FILTER_VALIDATE_IP);

Expand Down
3 changes: 3 additions & 0 deletions users/group.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
// Checkin What level user has permission to view this page
page_require_level(1);

// Setting language var
$lang->set('users.php');

$all_groups = find_all('user_groups');

?>
Expand Down