if($language=db_fetch_object(db_query("SELECT * FROM {languages} WHERE language = '%s'",$langcode))){
...
...
@@ -239,14 +239,14 @@ function _locale_language_form(&$form, $language = NULL) {
'#description'=>t('This should be an <a href="@rfc4646">RFC 4646</a> compliant language identifier. Basic tags use a country code with an optional script or regional variant name, like "en", "en-US" and "zh-Hant".',array('@rfc4646'=>'http://www.ietf.org/rfc/rfc4646.txt')),
);
}
$form['langname']=array('#type'=>'textfield',
$form['name']=array('#type'=>'textfield',
'#title'=>t('Language name in English'),
'#maxlength'=>64,
'#default_value'=>@$language->name,
'#required'=>TRUE,
'#description'=>t('Name of the language. Will be available for translation in all languages.'),
);
$form['langnative']=array('#type'=>'textfield',
$form['native']=array('#type'=>'textfield',
'#title'=>t('Native language name'),
'#maxlength'=>64,
'#default_value'=>@$language->native,
...
...
@@ -289,10 +289,10 @@ function _locale_admin_manage_add_screen() {
db_query("UPDATE {languages} SET name = '%s', native = '%s', domain = '%s', prefix = '%s', direction = %d WHERE language = '%s'",$form_values['langname'],$form_values['langnative'],$form_values['domain'],$form_values['prefix'],$form_values['direction'],$form_values['langcode']);
db_query("UPDATE {languages} SET name = '%s', native = '%s', domain = '%s', prefix = '%s', direction = %d WHERE language = '%s'",$form_values['name'],$form_values['native'],$form_values['domain'],$form_values['prefix'],$form_values['direction'],$form_values['langcode']);
$trans=db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND languauge = '%s'",$lid,$key));
$trans=db_fetch_object(db_query("SELECT translation FROM {locales_target} WHERE lid = %d AND language = '%s'",$lid,$key));
if(isset($trans->translation)){
db_query("UPDATE {locales_target} SET translation = '%s' WHERE lid = %d AND language = '%s'",$value,$lid,$key);
}
...
...
@@ -1297,13 +1300,15 @@ function _locale_import_parse_quoted($string) {
/**
* Exports a Portable Object (Template) file for a language
*
* @param $language Selects a language to generate the output for
* @param $language
* Language code to generate the output for, or NULL if generating
* translation template.
*/
function_locale_export_po($language){
function_locale_export_po($language=NULL){
global$user;
$header='';
// Get language specific strings, or all strings
if($language){
if(isset($language)){
$meta=db_fetch_object(db_query("SELECT * FROM {languages} WHERE language = '%s'",$language));
$result=db_query("SELECT s.lid, s.source, s.location, t.translation, t.plid, t.plural FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid WHERE t.language = '%s' ORDER BY t.plid, t.plural",$language);
}
...
...
@@ -1326,9 +1331,9 @@ function _locale_export_po($language) {
}
// Generating Portable Object file for a language
if($language){
if(isset($language)){
$filename=$language.'.po';
$header.="# $meta->name translation of ".variable_get('site_name','Drupal')."\n";
$header="# $meta->name translation of ".variable_get('site_name','Drupal')."\n";
@@ -34,6 +34,7 @@ function locale_help($section) {
return'<p>'.t("This page allows you to import a translation provided in the gettext Portable Object (.po) format. The easiest way to get your site translated is to obtain an existing Drupal translation and to import it. You can find existing translations on the <a href=\"@url\">Drupal translation page</a>. Note that importing a translation file might take a while.",array('@url'=>'http://drupal.org/project/translations')).'</p>';
case'admin/build/locale/language/export':
return'<p>'.t("This page allows you to export Drupal strings. The first option is to export a translation so it can be shared. The second option generates a translation template, which contains all Drupal strings, but without their translations. You can use this template to start a new translation using various software packages designed for this task.").'</p>';
case'admin/build/locale/string':
case'admin/build/locale/string/search':
return'<p>'.t("It is often convenient to get the strings from your setup on the <a href=\"@export\">export page</a>, and use a desktop Gettext translation editor to edit the translations. On this page you can search in the translated and untranslated strings, and the default English texts provided by Drupal.",array("@export"=>url("admin/build/locale/language/export"))).'</p>';
case'admin/build/locale/language/configure':
...
...
@@ -315,11 +316,19 @@ function locale_language_name($lang) {
* @param $field
* 'name' => names in current language, localized
* 'native' => native names
* @param $all
* Boolean to return all languages or only enabled ones