- upgrade and make_project scripts: run update_translations.php,

which compiles the translation files into the form
    used by the web code.
    Projects that don't use "upgrade" will need to do this manually
    whenever translation files change.

svn path=/trunk/boinc/; revision=17652
This commit is contained in:
David Anderson 2009-03-24 21:24:57 +00:00
parent a171360594
commit 0f6de2ea58
6 changed files with 58 additions and 11 deletions

View File

@ -3281,3 +3281,21 @@ David 24 Mar 2009
client/
main.cpp,h
David 24 Mar 2009
- upgrade and make_project scripts: run update_translations.php,
which compiles the translation files into the form
used by the web code.
Projects that don't use "upgrade" will need to do this manually
whenever translation files change.
html/
inc/
translation.inc
ops/
update_translations.php
user/
language_select.php
tools/
upgrade
make_project

View File

@ -20,8 +20,7 @@ $lang_language_dir = "../languages/";
$lang_translations_dir = "translations/";
$lang_prj_translations_dir = "project_specific_translations/";
$lang_compiled_dir = "compiled/";
$lang_log_level = 0;
$lang_log_file = $lang_language_dir."translator.log";
$lang_log_level = 1;
/**
* Fetches a list of compiled languages from the directory
@ -30,6 +29,7 @@ $lang_log_file = $lang_language_dir."translator.log";
*/
function getSupportedLanguages(){
global $lang_language_dir, $lang_compiled_dir;
$list = array();
if (is_dir($lang_language_dir.$lang_compiled_dir)) {
if ($dh = opendir($lang_language_dir.$lang_compiled_dir)) {
while ($file = readdir($dh)) {
@ -180,19 +180,13 @@ function tr_specific($text, $language){
}
function language_log($message, $loglevel=0){
global $lang_log_level, $lang_log_file;
global $lang_log_level;
if ($loglevel==0) $msg = "[ Debug ]";
if ($loglevel==1) $msg = "[ Warning ]";
if ($loglevel==2) $msg = "[ CRITICAL ]";
if ($loglevel>=$lang_log_level){
$fh = fopen($lang_log_file,"a");
if (!$fh) {
echo "failed to open log file $lang_log_file\n";
return;
}
fwrite($fh, date("Y-m-d H:i:s",time())." ".$msg." ".$message."\n");
fclose($fh);
echo date("Y-m-d H:i:s",time())." ".$msg." ".$message."\n";
}
}

View File

@ -1,4 +1,21 @@
<?php
// This file is part of BOINC.
// http://boinc.berkeley.edu
// Copyright (C) 2008 University of California
//
// BOINC is free software; you can redistribute it and/or modify it
// under the terms of the GNU Lesser General Public License
// as published by the Free Software Foundation,
// either version 3 of the License, or (at your option) any later version.
//
// BOINC is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
// See the GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with BOINC. If not, see <http://www.gnu.org/licenses/>.
error_reporting(E_ALL);
ini_set('display_errors', true);
ini_set('display_startup_errors', true);
@ -7,5 +24,4 @@ require_once("../inc/translation.inc");
buildLanguages($lang_language_dir,$lang_translations_dir, $lang_compiled_dir);
buildLanguages($lang_language_dir,$lang_prj_translations_dir, $lang_compiled_dir, true);
echo "update_translations finished\n";
?>

View File

@ -21,6 +21,10 @@ require_once("../inc/util.inc");
require_once("../inc/translation.inc");
$languages = getSupportedLanguages();
if (!is_array($languages)) {
error_page("Language selection not enabled. Project admins must run the update_translations.php script.");
}
$prefs = $_SERVER["HTTP_ACCEPT_LANGUAGE"];
$set_lang = get_str("set_lang", true);

View File

@ -278,6 +278,16 @@ try:
except:
print '''Couldn't find svnversion'''
try:
os.system('/bin/sh -c /usr/bin/svnversion > '+proot+'/db_revision')
except:
print '''Couldn't find svnversion'''
try:
os.system('cd '+proot+'/html/ops; php update_translations.php')
except:
print '''Couldn't install translation files'''
print '''Done installing default daemons.'''
# copy the test app if needed

View File

@ -70,6 +70,11 @@ try:
except:
print '''Couldn't find svnversion'''
try:
os.system('cd '+INSTALL_DIR+'/html/ops; php update_translations.php')
except:
print '''Couldn't install translation files'''
os.system('cd '+INSTALL_DIR+'/html/ops; ./upgrade_db.php')
if not options.web_only: