Welcome Guest, Not a member yet? Register   Sign In
Get list of available languages
#2

(This post was last modified: 07-27-2021, 05:47 AM by InsiteFX. Edit Reason: Added helper method to get language list. )

We usally add the languages that were going to use, you could create your own array and add the languages to it.

Updated 07-27-2021 Added helper method.

PHP Code:
/**
 * Get a Language directory list
 *
 * Add to your own helper.
 */
if ( ! function_exists('getLangList'))
{
 
/**
 * getLangList ()
 * -------------------------------------------------------------------
 *
 * USAGE:
 *
 *  $list = getLangList();
 *  var_dump($list);
 *
 * @return array
 */
 
function getLangList()
 {
 
helper('filesystem');

 
$temp directory_map(APPPATH.'/Language'1);

 foreach (
$temp as $key => $value)
 {
    $list[] = substr($value0, -1);
 }

 return 
$list;
 }


This method willl return to you an array of all languages in the app/Language folder.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Get list of available languages - by Ryubal - 07-21-2021, 01:12 AM
RE: Get list of available languages - by InsiteFX - 07-21-2021, 04:47 AM



Theme © iAndrew 2016 - Forum software by © MyBB