Fast switching between languages (i18n) (CI 2.0.1) |
[eluser]YangHax[/eluser]
I've made a replacement for the core/Lang.php that allows you to use the vanilla language file locations and easily switch between languages. Make sure to autoload session. application/core/Lang.php (see /forums/viewthread/179779 for a bug fix to 2.0.l core overrides loading) Code: <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); application/config/config.php Code: /* Changing User's Language Code: // sets language in session and calls index
[eluser]YangHax[/eluser]
Sample usage in a view Code: <div id="language">
[eluser]InsiteFX[/eluser]
You still do not get it! You do not replace CodeIgniter core Class! You extend them. Any one in their right mind knows better then to use your Class because when they upgrade CodeIgniter it is going to over write your Class file! Learn to extend the Classes... InsiteFX
[eluser]YangHax[/eluser]
CI 2.0.1 User Guide "Core Classes" section: http://ellislab.com/codeigniter/user-gui...asses.html Quote:To use one of your own system classes instead of a default one simply place your version inside your local application/core directory ...no mentions that you MUST extend it vs. replacing it, or any negative implications of doing so. Also, I'm new to these forums and don't know the culture here, but "Learn to extend the Classes…" ? Have you lost your mind talking like that? If you have nothing useful to say, or you cannot say it in a civil manner, you should not say it at all. Re-read your message and think about the tone you're using.
[eluser]InsiteFX[/eluser]
Quote:Also, I’m new to these forums and don’t know the culture here, but “Learn to extend the Classes…” ? Have you lost your mind talking like that? If you have nothing useful to say, or you cannot say it in a civil manner, you should not say it at all. Re-read your message and think about the tone you’re using. I Know I have not lost my mind! Go ahead copy a system directory over and then tell me I have lost my mind. When there is a new veriosn of CodeIgniter all you have to do is copy over the new system directory, you never have to replace the application directory were your code is. And if you had a mind you would have searched the forums and read this all over the place! InsiteFX
[eluser]YangHax[/eluser]
Why would I need to replace the application directory where code is, with this approach, if there's an update? I replaced 100% of the Lang.php functionality.
[eluser]lisahill[/eluser]
You can turn on "fast user switching" to allow more than one user to stay logged in to a computer at a time. For example, if you're working on a spreadsheet of financial data and your daughter begs to check for iChat AV messages, you can switch to your daughter's account. When she's done checking for messages, you can switch back to your account and your spreadsheet is right where you left it. When fast user switching is turned on, the name of the current user is displayed in the upper-right corner of the menu bar. You can click the name to select another user to switch to. If the other user's account doesn't require a password, the computer switches automatically to the new user's home folder. Otherwise, you see a dialog asking for the user's password. College Girls
[eluser]YangHax[/eluser]
@wh1tel1te if you read my post, I have link to that same thread at almost very beginning. ...where it was determined - hey, it's A-OK to replace the core classes! |
Welcome Guest, Not a member yet? Register Sign In |