add a new language

Project:ProjectPier
Version:0.8.6-stable
Component:Code
Category:feature request
Priority:normal
Assigned:phpfreak
Status:closed - fixed
Description

The steps to add a new language seem somewhat "patchy" (i.e. the things needed to be changed manually in /application/views/access/login.php).

The select options could be constructed automatically by reading the content of the language directory. Each language would need additional information about the actual language (for the select option text, e.g. "English (US)". Perhaps the xx_xx.php unit could return this, or it could simply be a new string in the language file.

(later on, build in administrative options could be added to manage which languages should appear on the login page)

#1
Assigned to:Visitor» phpfreak
Status:new» closed - fixed

Here is code that detects languages that are present.

Insert this

<?php
$base_language
= config_option('installation_base_language', 'en_us');
include(
ROOT . '/language/locales.php');
if (
$handle = opendir(ROOT . '/language')) {
  while (
false !== ($file = readdir($handle))) {
    if (
$file != "." && $file != "..") {
      if (
array_key_exists( $file, $locales)) {
        if (
$file == $base_language) {
          echo
"<option value=\"$file\" selected=\"selected\">{$locales[$file]}</option>";
        } else {
          echo
"<option value=\"$file\">{$locales[$file]}</option>";
        }
      }
    }
  }
 
closedir($handle);
}
?>

after this line
<select name="loginLanguage" id="loginLanguage">

I guess it is clear what to remove (i.e. all the option lines).

#6
Title:Detection of installed languages» add a new language