Overview
This project demonstrates how to implement dynamic language translation in a web application built with PHPMaker. The system allows users to manage and use translations seamlessly across various pages. Key features include a multi-language interface, real-time language switching, and dynamic messages retrieved from the database.
Tables and Their Roles
- Users: Stores user information and demonstrates dynamic, language-specific messages during actions like adding, editing, or deleting records.
- Language: Maintains a list of available languages, allows administrators to activate or deactivate languages, and displays language names with country flags in the user interface.
- Language_Translation: Stores translation entries for various phrases or terms, facilitating dynamic content translation.
- Levels: Manages user roles or levels for permission control.
- Level_Permissions: Specifies permissions for each user level to enforce access control on various actions.
Key Features
- Dynamic Language Switching: Users can change the interface language from a dropdown menu in the navigation bar. The dropdown displays the language name alongside the country flag for a user-friendly experience.
- Database-Driven Translations: All translatable messages are stored in the database (
Language_Translation
table), and messages adapt based on the user’s selected language. - Language Management: Admins can manage languages via the
Language
table, activating or deactivating them as needed. - Practical Example: The
Users
table demonstrates dynamic cancel messages fetched from the database, tailored to the selected language.
Usage Instructions
- Setting Up Languages: Add new languages in the
Language
table, specifying the language ID, name, and corresponding country flag. Use the activation status field to control language availability. - Adding Translations: Use the
Language_Translation
table to add or update translations for specific terms or messages. - Testing the System: Navigate to the
Users
table and try adding, editing, or deleting a record. Observe the cancel message displayed in the modal. - Switching Languages: Use the language dropdown menu in the navigation bar to change the application language.
- Managing Language Settings: Activate or deactivate languages via the
Language
table. Deactivated languages are excluded from the dropdown menu.
Benefits
- Dynamic and Scalable: New languages and translations can be added from the admin interface without modifying code.
- User-Centric: The interface adapts to the user’s preferred language.
- Real-Time Updates: Changes in language or translations are applied immediately.
Login
- User: admin
- password: master
- How to check: Go to the users table and try to add a new record or edit or delete added record. In each case, the message about the cancellation of the operation is displayed dynamically based on the language.