Skip to content

Commit 1fe06e7

Browse files
committed
feat: Add comprehensive i18n (internationalization) support
This PR introduces a complete internationalization system for ITFlow with: Core Features: - Modular language file structure (lang/{locale}/{module}.php) - Translation helper functions __() and __t() with placeholder support - Automatic browser language detection from HTTP_ACCEPT_LANGUAGE - Cookie-based language persistence (1 year) - Language priority: Cookie > User DB > Browser > Default Implementation: - Internationalized login page - Internationalized navigation (sidebar + top bar) - Internationalized dashboard (charts, widgets, controls) - Language switcher dropdown component Languages: - English (en_US) - 210+ translation keys - German (de_DE) - 210+ translation keys Modules: - common.php: Shared UI, navigation, login, messages, validation - dashboard.php: Dashboard-specific charts and widgets Architecture: - Easy to extend with new languages - Easy to add new modules - Clean separation of concerns - No breaking changes to existing code
1 parent 163aa30 commit 1fe06e7

12 files changed

Lines changed: 747 additions & 62 deletions

File tree

agent/dashboard.php

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
<input type="hidden" name="enable_financial" value="0">
5151
<input type="hidden" name="enable_technical" value="0">
5252

53-
<label for="year" class="mr-sm-2">Select Year:</label>
53+
<label for="year" class="mr-sm-2"><?php echo __('select_year', 'Select Year'); ?>:</label>
5454
<select id="year" onchange="this.form.submit()" class="form-control mr-sm-3 col-sm-2 mb-3 mb-sm-0" name="year">
5555
<?php while ($row = mysqli_fetch_array($sql_years_select)) {
5656
$year_select = $row['all_years'];
@@ -67,14 +67,14 @@
6767
<?php if ($session_user_role == 1 || ($session_user_role == 3 && $config_module_enable_accounting == 1)) { ?>
6868
<div class="custom-control custom-switch mr-3">
6969
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch1" name="enable_financial" value="1" <?php if ($user_config_dashboard_financial_enable == 1) { echo "checked"; } ?>>
70-
<label class="custom-control-label" for="customSwitch1">Financial</label>
70+
<label class="custom-control-label" for="customSwitch1"><?php echo __('financial', 'Financial'); ?></label>
7171
</div>
7272
<?php } ?>
7373

7474
<?php if ($session_user_role >= 2 && $config_module_enable_ticketing == 1) { ?>
7575
<div class="custom-control custom-switch">
7676
<input type="checkbox" onchange="this.form.submit()" class="custom-control-input" id="customSwitch2" name="enable_technical" value="1" <?php if ($user_config_dashboard_technical_enable == 1) { echo "checked"; } ?>>
77-
<label class="custom-control-label" for="customSwitch2">Technical</label>
77+
<label class="custom-control-label" for="customSwitch2"><?php echo __('technical', 'Technical'); ?></label>
7878
</div>
7979
<?php } ?>
8080
</form>
@@ -282,7 +282,7 @@
282282
<a class="small-box bg-secondary" href="clients.php?leads=1&dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31">
283283
<div class="inner">
284284
<h3><?php echo $leads_added; ?></h3>
285-
<p>New Leads</p>
285+
<p><?php echo __('new_leads', 'New Leads'); ?></p>
286286
</div>
287287
<div class="icon">
288288
<i class="fa fa-users"></i>
@@ -310,7 +310,7 @@
310310
<a class="small-box bg-secondary" href="vendors.php?dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31">
311311
<div class="inner">
312312
<h3><?php echo $vendors_added; ?></h3>
313-
<p>New Vendors</p>
313+
<p><?php echo __('new_vendors', 'New Vendors'); ?></p>
314314
</div>
315315
<div class="icon">
316316
<i class="fa fa-building"></i>
@@ -324,7 +324,7 @@
324324
<a class="small-box bg-secondary" href="trips.php?dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31">
325325
<div class="inner">
326326
<h3><?php echo number_format($total_miles, 2); ?></h3>
327-
<p>Miles Traveled</p>
327+
<p><?php echo __('miles_traveled', 'Miles Traveled'); ?></p>
328328
</div>
329329
<div class="icon">
330330
<i class="fa fa-route"></i>
@@ -336,7 +336,7 @@
336336
<div class="col-md-12">
337337
<div class="card card-dark mb-3">
338338
<div class="card-header">
339-
<h3 class="card-title"><i class="fas fa-fw fa-chart-area mr-2"></i>Cash Flow</h3>
339+
<h3 class="card-title"><i class="fas fa-fw fa-chart-area mr-2"></i><?php echo __('cash_flow', 'Cash Flow'); ?></h3>
340340
<div class="card-tools">
341341
<a href="reports/income_summary.php" class="btn btn-tool">
342342
<i class="fas fa-eye"></i>
@@ -357,7 +357,7 @@
357357
<div class="col-lg-4">
358358
<div class="card card-dark mb-3">
359359
<div class="card-header">
360-
<h3 class="card-title"><i class="fas fa-fw fa-chart-pie mr-2"></i>Income by Category <small>(Top 5)</small></h3>
360+
<h3 class="card-title"><i class="fas fa-fw fa-chart-pie mr-2"></i><?php echo __('income_by_category', 'Income by Category'); ?> <small>(<?php echo __('top_5', 'Top 5'); ?>)</small></h3>
361361
<div class="card-tools">
362362
<button type="button" class="btn btn-tool" data-card-widget="remove">
363363
<i class="fas fa-times"></i>
@@ -375,7 +375,7 @@
375375
<div class="col-lg-4">
376376
<div class="card card-dark mb-3">
377377
<div class="card-header">
378-
<h3 class="card-title"><i class="fa fa-fw fa-shopping-cart mr-2"></i>Expenses by Category <small>(Top 5)</small></h3>
378+
<h3 class="card-title"><i class="fa fa-fw fa-shopping-cart mr-2"></i><?php echo __('expenses_by_category', 'Expenses by Category'); ?> <small>(<?php echo __('top_5', 'Top 5'); ?>)</small></h3>
379379
<div class="card-tools">
380380
<button type="button" class="btn btn-tool" data-card-widget="remove">
381381
<i class="fas fa-times"></i>
@@ -393,7 +393,7 @@
393393
<div class="col-lg-4">
394394
<div class="card card-dark mb-3">
395395
<div class="card-header">
396-
<h3 class="card-title"><i class="fa fa-fw fa-building mr-2"></i>Expenses by Vendor <small>(Top 5)</small></h3>
396+
<h3 class="card-title"><i class="fa fa-fw fa-building mr-2"></i><?php echo __('expenses_by_vendor', 'Expenses by Vendor'); ?> <small>(<?php echo __('top_5', 'Top 5'); ?>)</small></h3>
397397
<div class="card-tools">
398398
<button type="button" class="btn btn-tool" data-card-widget="remove">
399399
<i class="fas fa-times"></i>
@@ -411,7 +411,7 @@
411411
<div class="col-md-4">
412412
<div class="card card-dark mb-3">
413413
<div class="card-header">
414-
<h3 class="card-title"><i class="fa fa-fw fa-piggy-bank mr-2"></i>Account Balances</h3>
414+
<h3 class="card-title"><i class="fa fa-fw fa-piggy-bank mr-2"></i><?php echo __('account_balances', 'Account Balances'); ?></h3>
415415
<div class="card-tools">
416416
<button type="button" class="btn btn-tool" data-card-widget="remove">
417417
<i class="fas fa-times"></i>
@@ -459,7 +459,7 @@
459459
<div class="col-md-4">
460460
<div class="card card-dark mb-3">
461461
<div class="card-header">
462-
<h3 class="card-title"><i class="fas fa-fw fa-credit-card mr-2"></i>Latest Income</h3>
462+
<h3 class="card-title"><i class="fas fa-fw fa-credit-card mr-2"></i><?php echo __('latest_income', 'Latest Income'); ?></h3>
463463
<div class="card-tools">
464464
<button type="button" class="btn btn-tool" data-card-widget="remove">
465465
<i class="fas fa-times"></i>
@@ -500,7 +500,7 @@
500500
<div class="col-md-4">
501501
<div class="card card-dark mb-3">
502502
<div class="card-header">
503-
<h3 class="card-title"><i class="fas fa-fw fa-shopping-cart mr-2"></i>Latest Expenses</h3>
503+
<h3 class="card-title"><i class="fas fa-fw fa-shopping-cart mr-2"></i><?php echo __('latest_expenses', 'Latest Expenses'); ?></h3>
504504
<div class="card-tools">
505505
<button type="button" class="btn btn-tool" data-card-widget="remove">
506506
<i class="fas fa-times"></i>
@@ -540,7 +540,7 @@
540540
<div class="col-md-12">
541541
<div class="card card-dark mb-3">
542542
<div class="card-header">
543-
<h3 class="card-title"><i class="fas fa-fw fa-route mr-2"></i>Trip Flow</h3>
543+
<h3 class="card-title"><i class="fas fa-fw fa-route mr-2"></i><?php echo __('trip_flow', 'Trip Flow'); ?></h3>
544544
<div class="card-tools">
545545
<a href="trips.php" class="btn btn-tool">
546546
<i class="fas fa-eye"></i>
@@ -608,7 +608,7 @@
608608
<a class="small-box bg-secondary" href="clients.php?dtf=<?php echo $year; ?>-01-01&dtt=<?php echo $year; ?>-12-31">
609609
<div class="inner">
610610
<h3><?php echo $clients_added; ?></h3>
611-
<p>New Clients</p>
611+
<p><?php echo __('new_clients', 'New Clients'); ?></p>
612612
</div>
613613
<div class="icon">
614614
<i class="fa fa-users"></i>
@@ -621,7 +621,7 @@
621621
<a class="small-box bg-success" href="contacts.php">
622622
<div class="inner">
623623
<h3><?php echo $contacts_added; ?></h3>
624-
<p>New Contacts</p>
624+
<p><?php echo __('new_contacts', 'New Contacts'); ?></p>
625625
</div>
626626
<div class="icon">
627627
<i class="fa fa-user"></i>
@@ -634,7 +634,7 @@
634634
<a class="small-box bg-info" href="assets.php">
635635
<div class="inner">
636636
<h3><?php echo $assets_added; ?></h3>
637-
<p>New Assets</p>
637+
<p><?php echo __('new_assets', 'New Assets'); ?></p>
638638
</div>
639639
<div class="icon">
640640
<i class="fa fa-desktop"></i>
@@ -647,7 +647,7 @@
647647
<a class="small-box bg-danger" href="tickets.php">
648648
<div class="inner">
649649
<h3><?php echo $active_tickets; ?></h3>
650-
<p>Active Tickets</p>
650+
<p><?php echo __('active_tickets', 'Active Tickets'); ?></p>
651651
</div>
652652
<div class="icon">
653653
<i class="fa fa-ticket-alt"></i>
@@ -660,7 +660,7 @@
660660
<a class="small-box bg-warning" href="domains.php?sort=domain_expire&order=ASC">
661661
<div class="inner">
662662
<h3><?php echo $expiring_domains; ?></h3>
663-
<p>Expiring Domains <small>30 Day</small></p>
663+
<p><?php echo __('expiring_domains', 'Expiring Domains'); ?> <small><?php echo __('30_day', '30 Day'); ?></small></p>
664664
</div>
665665
<div class="icon">
666666
<i class="fa fa-globe"></i>
@@ -673,7 +673,7 @@
673673
<a class="small-box bg-primary" href="certificates.php?sort=certificate_expire&order=ASC">
674674
<div class="inner">
675675
<h3><?php echo $expiring_certificates; ?></h3>
676-
<p>Expiring Certificates<small>30 Day</small></p>
676+
<p><?php echo __('expiring_certificates', 'Expiring Certificates'); ?><small><?php echo __('30_day', '30 Day'); ?></small></p>
677677
</div>
678678
<div class="icon">
679679
<i class="fa fa-lock"></i>
@@ -688,7 +688,7 @@
688688
<div class="col-12">
689689
<div class="card card-dark mb-3">
690690
<div class="card-header">
691-
<h3 class="card-title"><i class="fa fa-fw fa-life-ring mr-2"></i>Your Open Tickets</h3>
691+
<h3 class="card-title"><i class="fa fa-fw fa-life-ring mr-2"></i><?php echo __('your_open_tickets', 'Your Open Tickets'); ?></h3>
692692
<div class="card-tools">
693693
<button type="button" class="btn btn-tool" data-card-widget="remove">
694694
<i class="fas fa-times"></i>

0 commit comments

Comments
 (0)