Skip to content

Conversation

@samirbrkic
Copy link

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

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
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello & Welcome! :)

Thanks for taking the time to help improve ITFlow. We're excited to review your contributions - we'll review this PR as soon as we can!

Whilst you're waiting, please feel free to check out the forum.

Just so you know, all contributions to ITFlow are licensed under the GNU GPL. By contributing you grant us a perpetual & irrevocable license to include your work in ITFlow.

- Add locale format validation (regex) to prevent path traversal attacks
- Add htmlspecialchars() to escape user-controlled output and prevent XSS
- Ensure locale format matches expected pattern (e.g., en_US, de_DE)
- Escape all language names before HTML output
- Replace regex validation with hardcoded whitelist of allowed locales
- Prevents path injection by never using unsanitized user input in paths
- Fix XSS vulnerability in redirect URL by using PHP_SELF instead of REQUEST_URI
- Update i18n_get_available_languages() to use whitelist instead of directory scan
- Add clear documentation for adding new languages to whitelist

Security improvements:
- Line 90 (i18n.php): Use whitelisted locale value, not user input
- Line 32 (language_switcher.php): Sanitize redirect URL with htmlspecialchars
- Eliminates all path traversal and XSS attack vectors
- Create lang/en_US/tickets.php with 80+ ticket-related translations
- Create lang/de_DE/tickets.php with German translations
- Internationalize tickets.php page:
  - Header (Tickets, Open, Closed counts)
  - Actions (New Ticket, Export)
  - Search and filters
  - View options (List, Kanban)
  - My Tickets dropdown
  - Unassigned button
  - Bulk actions menu (Assign, Category, Priority, Reply, Project, Merge, Resolve)
  - Advanced filters (Date range, Status, Assigned to)

Translations cover:
- Page navigation and controls
- Bulk operations
- Filter labels and placeholders
- Status indicators
- User-facing text
- Rename second occurrence to 'ticket_status_label' to avoid array key collision
- Fixes SonarQube reliability warning about overwritten array values
- Create lang/en_US/clients.php with 75+ client-related translations
- Create lang/de_DE/clients.php with German translations
- Internationalize clients.php page:
  - Header (Clients/Leads toggle)
  - Actions (New, Import, Export)
  - Search placeholders
  - Client/Lead filter buttons
  - Archived toggle
  - Bulk actions menu (Open Tickets, Set Hourly Rate, Set Industry, Set Referral, Assign Tags, Send Email, Archive/Restore)

Translations cover:
- Client vs Lead terminology
- Filter and navigation controls
- Bulk operations
- Status indicators
- User-facing labels

No duplicate keys detected
- Add missing translations: 'ticket', 'billable', 'not_assigned'
- Translate all table column headers in ticket_list.php
- Translate 'Not Assigned' status text
- Now displays: Ticket, Subject, Client, Contact, Billable, Priority, Status, Assigned, Last Response, Created in selected language

No duplicate keys detected
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jan 6, 2026

@samirbrkic samirbrkic closed this Jan 6, 2026
@samirbrkic samirbrkic deleted the i18n-clean branch January 6, 2026 22:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants