LMSouq
general-dev Open

Best practice multi language website

JO
Joshua - Pendo
1 month ago
3 views
Problem Description
I've been struggling with this question for quite some months now, but I haven't been in a situation that I needed to explore all possible options before. Right now, I feel like it's time to get to know the possibilities and create my own personal preference to use in my upcoming projects. **Let me first sketch the situation I'm looking for** I'm about to upgrade/redevelop a content management system which I've been using for quite a while now. However, I'm feeling multi language is a great improvement to this system. Before I did not use any frameworks but I'm going to use Laraval4 for the upcoming project. Laravel seems the best choice of a cleaner way to code PHP. `Sidenote: Laraval4 should be no factor in your answer`. I'm looking for general ways of translation that are platform/framework independent. **What should be translated** As the system I am looking for needs to be as user friendly as possible the method of managing the translation should be inside the CMS. There should be no need to start up an FTP connection to modify translation files or any html/php parsed templates. Furthermore, I'm looking for the easiest way to translate multiple database tables perhaps without the need of making additional tables. **What did I come up with myself** As I've been searching, reading and trying things myself already. There are a couple of options I have. But I still don't feel like I've reached a best practice method for what I am really seeking. Right now, this is what I've come up with, but this method also has it side effects. 1. **PHP Parsed Templates**: the template system should be parsed by PHP. This way I'm able to insert the translated parameters into the HTML without having to open the templates and modify them. Besides that, PHP parsed templates gives me the ability to have 1 template for the complete website instead of having a subfolder for each language (which I've had before). The method to reach this target can be either Smarty, TemplatePower, Laravel's Blade or any other template parser. As I said this should be independent to the written solution. 2. **Database Driven**: perhaps I don't need to mention this again. But the solution should be database driven. The CMS is aimed to be object oriented and MVC, so I would need to think of a logical data structure for the strings. As my templates would be structured: templates/Controller/View.php perhaps this structure would make the most sense: `Controller.View.parameter`. The database table would have these fields a long with a `value` field. Inside the templates we could use some sort method like `echo __('Controller.View.welcome', array('name', 'Joshua'))` and the parameter contains `Welcome, :name`. Thus the result being `Welcome, Joshua`. This seems a good way to do this, because the parameters such as :name are easy to understand by the editor. 3. **Low Dat...

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base