Patch - Choose language upon C5 installation
Permalink
Hi!
This could interest you.
controllers/install.phphttp://pastebin.com/NUWmPK6B
single_pages/install.phphttp://pastebin.com/dtdQcN7r
Yeah I know a patch file would be nicer, but I don't have netbeans installed atm.
This basically gives you a dropdown of the installed languages upon a c5 install and set the chosen language as active language in your site.php
This could interest you.
controllers/install.phphttp://pastebin.com/NUWmPK6B
single_pages/install.phphttp://pastebin.com/dtdQcN7r
Yeah I know a patch file would be nicer, but I don't have netbeans installed atm.
This basically gives you a dropdown of the installed languages upon a c5 install and set the chosen language as active language in your site.php
Nice. We'll take a look at including this. We've got some thoughts about including multilingual installation in concrete5 but this looks like it'd get the job done quickly and nicely.
This would be great.
Thank you for bringing this up!
Thank you for bringing this up!
thx :)
I'm happy to have helped you.
I'm happy to have helped you.
I added a screenshot!
And a nice enhancement.
http://image-upload.de/image/Rw7Fz8/c991b150bf.png...
And a nice enhancement.
http://image-upload.de/image/Rw7Fz8/c991b150bf.png...
<?php $folder = "./".DIRNAME_LANGUAGES; if (is_dir($folder)){ $contents = scandir($folder); $bad = array(".", "..", ".DS_Store", "_notes", "thumbs.db", "Thumbs.db"); $files = array_diff($contents, $bad); array_push($files, 'en_US'); } ?> <label for="LOCALE"><?php echo t('Language')?></label><br/> <?php echo '<select name="LOCALE">'; foreach($files as $language) { if($language == 'da_DK') $language = 'Dansk'; if($language == 'de_DE') $language = 'Deutsch';
Viewing 15 lines of 28 lines. View entire code block.
Good solution.
I will propose this to the next Japanese version.
Thank you.
I will propose this to the next Japanese version.
Thank you.
:) Thanks!
There's a little you can enhance on it though. I've added an empty <option> on my install, so that Dansk isn't the default.
Also installing without selecting a language results in an error, because setting LOCALE to "" won't work. That's why it would be better to put in validation and exception handling.
It's up to you, but you could put in a "smart default" for the dropdown if you want too. I'm specifically talking about browser_language detection code.
Have a nice Weekend!
There's a little you can enhance on it though. I've added an empty <option> on my install, so that Dansk isn't the default.
Also installing without selecting a language results in an error, because setting LOCALE to "" won't work. That's why it would be better to put in validation and exception handling.
It's up to you, but you could put in a "smart default" for the dropdown if you want too. I'm specifically talking about browser_language detection code.
Have a nice Weekend!
Single Page:
Controller line ~987: