Welcome Guest, Not a member yet? Register   Sign In
*idea* - Translation system *idea*
#11

[eluser]Silviu[/eluser]
Quote:Well, the idea is not bad, but performance wise, you’ll suffer, just because of the database look-ups.

The idea is that for each and every string, there will be (at most) only one database search for every language. This means one search EVER, not one search per page load. Once the search is done, the string is properly written into a language file (cache) and on the next page load it will be read on from there.

This means that once you (as developer or owner) browse your site (without either a table or a cache file), entries are being added to the system, and it's enough to browse some pages to build the initial cache. Later on, only small performance hits will happen now and then, when a user encounters a string that was not displayed ever for anyone else until then.

When translating (using a proper admin/translation module) the language file/cache will be updated automatically with the database content.

What do you think it's the best option to implement it? A helper function? A model? What do we need?

Unfortunately I'm low on free time these days, as I have a personal project on my hands. And a baby girl. Two days old. YAY! :-)
#12

[eluser]Twisted1919[/eluser]
Hehe, sa-ti traiasca Wink
Now, going back to our issue, in english this time, i think you'll need the entire suite:
* a model - to talk to the database
* a library - to talk to the model
* a helper - to be called from within the views/controllers and which talks to the library.
#13

[eluser]Silviu[/eluser]
@Twisted1919: Thanks! I thought I was having eyesight problems for a moment there.

Now back to business.

The library won't be very hard to implement.
I'm not sure where to drop the model though.
The helper is _the_ easiest part.

Also, the library needs to be language-aware, to load the proper file and add the proper database entries when needed.

Granted, it's better to use a hash in the language table rather than a string.
Also, the strings need to be trimmed before being processed...
This library will require it's own folder to write and read the language files to.

Am I missing anything else?
#14

[eluser]Twisted1919[/eluser]
I think you narrowed it down pretty much.
Anyway, when you'll start writing the actual code you'll know better what to do.

****
the model will reside in /models (say Language_model.php)
the library in /libraries (say Language_lib.php)
the helper in /helpers (say language_helper.php)
You need to auto-load these in autoload.php




Theme © iAndrew 2016 - Forum software by © MyBB