$lid=db_query("SELECT lid FROM {locales_source} WHERE source = :source AND context = :context AND textgroup = :textgroup",array(':source'=>$source,':context'=>$context,':textgroup'=>$textgroup))->fetchField();
$lid=db_query("SELECT lid FROM {locales_source} WHERE source = :source AND context = :context",array(':source'=>$source,':context'=>$context))->fetchField();
if(!empty($translation)){
// Skip this string unless it passes a check for dangerous code.
// Text groups other than default still can contain HTML tags
$source=db_query("SELECT lid, location FROM {locales_source} WHERE source = :source AND textgroup = 'default'",array(':source'=>$string))->fetchObject();
$source=db_query("SELECT lid, location FROM {locales_source} WHERE source = :source",array(':source'=>$string))->fetchObject();
if($source){
// We already have this source string and now have to add the location
// to the location column, if this file is not yet present in there.
...
...
@@ -1439,7 +1425,6 @@ function _locale_parse_js_file($filepath) {
'location'=>$filepath,
'source'=>$string,
'context'=>'',
'textgroup'=>'default',
))
->execute();
}
...
...
@@ -1460,16 +1445,13 @@ function _locale_parse_js_file($filepath) {
* @param $language
* Language object to generate the output for, or NULL if generating
* translation template.
* @param $group
* Text group to export PO file from (eg. 'default' for interface
$result=db_query("SELECT s.lid, s.source, s.context, s.location, t.translation, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.textgroup = :textgroup ORDER BY t.plid, t.plural",array(':language'=>$language->language,':textgroup'=>$group));
$result=db_query("SELECT s.lid, s.source, s.context, s.location, t.translation, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language ORDER BY t.plid, t.plural",array(':language'=>$language->language));
}
else{
$result=db_query("SELECT s.lid, s.source, s.context, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid WHERE s.textgroup = :textgroup ORDER BY t.plid, t.plural",array(':textgroup'=>$group));
$result=db_query("SELECT s.lid, s.source, s.context, s.location, t.plid, t.plural FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid ORDER BY t.plid, t.plural");
}
$strings=array();
foreach($resultas$child){
...
...
@@ -1740,7 +1722,7 @@ function _locale_rebuild_js($langcode = NULL) {
// Construct the array for JavaScript translations.
// Only add strings with a translation to the translations array.
$result=db_query("SELECT s.lid, s.source, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.location LIKE '%.js%' AND s.textgroup = :textgroup",array(':language'=>$language->language,':textgroup'=>'default'));
$result=db_query("SELECT s.lid, s.source, t.translation FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.location LIKE '%.js%'",array(':language'=>$language->language));
@@ -48,8 +48,7 @@ function locale_help($path, $arg) {
$output='<p>'.t('Determine the language from a request/session parameter. Example: "http://example.com?language=de" sets language to German based on the use of "de" within the "language" parameter.').'</p>';
return$output;
case'admin/config/regional/translate':
$output='<p>'.t('This page provides an overview of available translatable strings. Drupal displays translatable strings in text groups; modules may define additional text groups containing other translatable strings. Because text groups provide a method of grouping related strings, they are often used to focus translation efforts on specific areas of the Drupal interface.').'</p>';
$output.='<p>'.t('See the <a href="@languages">Languages page</a> for more information on adding support for additional languages.',array('@languages'=>url('admin/config/regional/language'))).'</p>';
$output='<p>'.t('This page provides an overview of available translatable strings. See the <a href="@languages">Languages page</a> for more information on adding support for additional languages.',array('@languages'=>url('admin/config/regional/language'))).'</p>';
return$output;
case'admin/config/regional/translate/import':
$output='<p>'.t('This page imports the translated strings contained in an individual Gettext Portable Object (<em>.po</em>) file. Normally distributed as part of a translation package (each translation package may contain several <em>.po</em> files), a <em>.po</em> file may need to be imported after offline editing in a Gettext translation editor. Importing an individual <em>.po</em> file may be a lengthy process.').'</p>';
...
...
@@ -58,7 +57,7 @@ function locale_help($path, $arg) {
case'admin/config/regional/translate/export':
return'<p>'.t('This page exports the translated strings used by your site. An export file may be in Gettext Portable Object (<em>.po</em>) form, which includes both the original string and the translation (used to share translations with others), or in Gettext Portable Object Template (<em>.pot</em>) form, which includes the original strings only (used to create new translations with a Gettext translation editor).').'</p>';
case'admin/config/regional/translate/translate':
return'<p>'.t('This page allows a translator to search for specific translated and untranslated strings, and is used when creating or editing translations. (Note: For translation tasks involving many strings, it may be more convenient to <a href="@export">export</a> strings for offline editing in a desktop Gettext translation editor.) Searches may be limited to strings found within a specific text group or in a specific language.',array('@export'=>url('admin/config/regional/translate/export'))).'</p>';
return'<p>'.t('This page allows a translator to search for specific translated and untranslated strings, and is used when creating or editing translations. (Note: For translation tasks involving many strings, it may be more convenient to <a href="@export">export</a> strings for offline editing in a desktop Gettext translation editor.) Searches may be limited to strings in a specific language.',array('@export'=>url('admin/config/regional/translate/export'))).'</p>';
case'admin/structure/block/manage/%/%':
if($arg[4]=='locale'&&$arg[5]=='language'){
return'<p>'.t('This block is only shown if <a href="@languages">at least two languages are enabled</a> and <a href="@configuration">language negotiation</a> is set to <em>URL</em> or <em>Session</em>.',array('@languages'=>url('admin/config/regional/language'),'@configuration'=>url('admin/config/regional/language/configure'))).'</p>';
...
...
@@ -257,16 +256,6 @@ function locale_permission() {
);
}
/**
* Implements hook_locale().
*/
functionlocale_locale($op='groups'){
switch($op){
case'groups':
returnarray('default'=>t('Built-in interface'));
}
}
/**
* Form builder callback to display language selection widget.
// Refresh database stored cache of translations for given language.
// We only store short strings used in current version, to improve
// performance and consume less memory.
$result=db_query("SELECT s.source, s.context, t.translation, t.language FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.textgroup = 'default' AND s.version = :version AND LENGTH(s.source) < :length",array(':language'=>$langcode,':version'=>VERSION,':length'=>variable_get('locale_cache_length',75)));
$result=db_query("SELECT s.source, s.context, t.translation, t.language FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.version = :version AND LENGTH(s.source) < :length",array(':language'=>$langcode,':version'=>VERSION,':length'=>variable_get('locale_cache_length',75)));
// We do not have this translation cached, so get it from the DB.
$translation=db_query("SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context AND s.textgroup = 'default'",array(
$translation=db_query("SELECT s.lid, t.translation, s.version FROM {locales_source} s LEFT JOIN {locales_target} t ON s.lid = t.lid AND t.language = :language WHERE s.source = :source AND s.context = :context",array(
// Languages with at least one record in the locale table.
$translations=db_query("SELECT COUNT(*) AS translation, t.language, s.textgroup FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid GROUP BY textgroup, language");
// If we have source strings, match translations and compute progress. Not
// all languages may have information.
$translations=db_query("SELECT COUNT(*) AS translation, t.language FROM {locales_source} s INNER JOIN {locales_target} t ON s.lid = t.lid GROUP BY language");
@@ -383,7 +342,7 @@ function locale_translate_edit_form($form, &$form_state, $lid) {
}
// Fetch translations and fill in default values in the form.
$result=db_query("SELECT DISTINCT translation, language FROM {locales_target} WHERE lid = :lid AND language <> :omit",array(':lid'=>$lid,':omit'=>$omit));
$result=db_query("SELECT DISTINCT translation, language FROM {locales_target} WHERE lid = :lid",array(':lid'=>$lid));