Allowing to use the same iso code when creating a new sub language

skala
Julio Montoya 15 years ago
parent 7972ac71c4
commit b1ea199b5a
  1. 10
      main/admin/sub_language.class.php
  2. 1
      main/admin/sub_language.php
  3. 3
      main/admin/sub_language_add.php
  4. 7
      main/admin/sub_language_ajax.inc.php

@ -91,7 +91,7 @@ class SubLanguageManager {
$var = trim($var); $val = trim($val);
$res_list[$var] = $val;
}
return $res_list;
return $res_list;
}
/**
@ -99,11 +99,9 @@ class SubLanguageManager {
* @param String The chamilo path file (/var/www/chamilo/main/lang/spanish/gradebook.inc.php)
* @return bool
*/
public static function add_file_in_language_directory ($system_path_file) {
$return_value = false;
if (file_exists($system_path_file) && is_writable($system_path_file)) {
$return_value = file_put_contents($system_path_file,'<?php'.PHP_EOL);
}
public static function add_file_in_language_directory($system_path_file) {
$return_value = false;
$return_value = @file_put_contents($system_path_file,'<?php'.PHP_EOL);
return $return_value;
}
/**

@ -193,6 +193,7 @@ function search_language_term($term, $search_in_variable = true , $search_in_eng
if (is_array($variable_value)) {
continue;
}
if (is_array($variable_value))
echo $lang_file;
$founded = false;

@ -83,10 +83,11 @@ function check_if_language_exist ($original_name,$english_name,$isocode,$sublang
$has_error=true;
$message_information['english_name']=true;
}
/*
if ($count_isocode==1) {
$has_error=true;
$message_information['isocode']=true;
}
}*/
if ($has_error===true) {
$message_information['execute_add']=false;
}

@ -6,7 +6,6 @@ require_once 'sub_language.class.php';
/*
* search a term and return description from a glossary
*/
global $charset;
$new_language = Security::remove_XSS($_REQUEST['new_language']);
$language_variable = Security::remove_XSS($_REQUEST['variable_language']);
@ -21,14 +20,14 @@ if (isset($new_language) && isset($language_variable) && isset($file_id)) {
$path_folder = api_get_path(SYS_LANG_PATH).$all_data_of_language['dokeos_folder'].'/'.$file_language;
$all_file_of_directory = SubLanguageManager::get_all_language_variable_in_file($path_folder);
$return_value = SubLanguageManager::add_file_in_language_directory ($path_folder);
$return_value = SubLanguageManager::add_file_in_language_directory($path_folder);
//update variable language
//@todo add filter for double quotes, to avoid breaking the string
//could be something like preg_replace('/.*[^\\]".*/','\"',api_...) ?
$all_file_of_directory[$language_variable]="\"".api_convert_encoding($new_language,$charset,'UTF-8')."\";";
$all_file_of_directory[$language_variable]="\"".api_convert_encoding($new_language, api_get_system_encoding(),'UTF-8')."\";";
$result_array = array();
foreach ($all_file_of_directory as $key_value=>$value_info) {
//echo $path_folder.' '.$value_info.' '.$key_value;
$result_array[$key_value] = SubLanguageManager::write_data_in_file($path_folder, $value_info, $key_value);
}
$variables_with_problems = '';

Loading…
Cancel
Save