Welcome Guest, Not a member yet? Register   Sign In
Multiple language Support
#5

(This post was last modified: 02-26-2015, 09:06 AM by RWCH.)

Hi itconstruct.

Quote:The 'filename' is static in the custom wrapper so I would pass this as a parameter to the function as I have more than one lang file per language.

Maybe you should just pass the language (and not the file name). Can't you construct the file names from the passed language? You should try to do this in a generic way.

Quote:I was wondering if it would be more beneficial to autoload the language needed with all variables specified in my application in some way although I presume this would use up additional i/o, memory/swap and bloat the application. Please let me know your thoughts about this sort of method.

You could. At some point you have to load the resource file and it does not really matter much if you do that with autoload or by just always loading it in your own base controller (usually MY_Controller). A matter of taste I guess. Autoload seems a little more cleaner.

Quote:Additionally the custom wrapper function where should I put this. I don't have access to look at my code atm but at this stage I was thinking perhaps making it into a helper.

I would go for a private method in your own base controller (usually MY_Controller). Loading the language resources has to be done once and with every page request and is a specific task which has to be executed by a controller (or indirect by a specified class, which seems overkill only for this task)

A helper file is simply a collection of functions in a particular category. They are not meant to do one specific task.  

Quote:Thanks for your advice so far.

Your welcome.

I would also like to see other people to comment on this. What I have written would be my approach, just based on my experience, but it is no way the preferred or the only way.
Reply


Messages In This Thread
Multiple language Support - by itconstruct - 02-23-2015, 03:27 AM
RE: Multiple language Support - by RWCH - 02-23-2015, 08:04 AM
RE: Multiple language Support - by itconstruct - 02-24-2015, 04:06 PM
RE: Multiple language Support - by RWCH - 02-26-2015, 09:00 AM
RE: Multiple language Support - by mwhitney - 02-25-2015, 02:04 PM
RE: Multiple language Support - by itconstruct - 06-27-2015, 04:50 AM
RE: Multiple language Support - by itconstruct - 06-27-2015, 05:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB