Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Lang class - fallback language
  • If a language file is not found during Lang::load(), the fallback language file is used instead. This is nice. I like to take it a step further. If a language line is not found in a loaded language file, the fallback line in the fallback language file is used instead. What do you think?
  • I second that! I'm having this problem right now. I tried modifying the Lang::line method but didn't get to work 100% Did you find a solution for this? I'm working on a multilingual site right now and It can be hard to notice missing translations here and there after a while. I would like to see the fallback translation instead.
  • This means you'll have to load both the intended language and the fallback language, and do an array_merge of the two. As you don't know whether or not the intended language file is complete, this means always have to do this, with will double the number of file I/O's (you always have to read two files), even if none of the lines is missing. I don't feel this should be core functionality, it will slow the framework down for everyone. Instead, if you make a language file, make sure all keys are present. For one of my (CI) apps, I have a small PHP script that loops over all non-english language files, reads them, merges with the english one, and writes them back. This ensures that every missing key is replaced by it's english value. The script also logs the missing keys, so the language files can be easily updated. I run this before every release of the app. (haven't had time to convert it to Fuel, must do that some day...)
  • You're right, that doesn't sound right at all. I'm gonna think about how I'm going to do this with my current project but I have to create something like you said for future projects.
  • I'm going to have to deal with this myself in the next few days. I'll let you guys know what I come up with.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion