Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
drupal
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Custom Issue Tracker
Custom Issue Tracker
Labels
Merge Requests
301
Merge Requests
301
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
project
drupal
Commits
f0b273a9
Commit
f0b273a9
authored
May 04, 2007
by
Gábor Hojtsy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#131061
: Very fast t() for a small set of strings,
by Moshe Weitzman, webernet, chx, erdemkose and myself
parent
8f36367d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
1 deletion
+28
-1
includes/common.inc
includes/common.inc
+15
-1
sites/default/settings.php
sites/default/settings.php
+13
-0
No files found.
includes/common.inc
View file @
f0b273a9
...
...
@@ -700,7 +700,21 @@ function fix_gpc_magic() {
*/
function
t
(
$string
,
$args
=
0
)
{
global
$language
;
if
(
function_exists
(
'locale'
)
&&
$language
->
language
!=
'en'
)
{
static
$custom_strings
;
// First, check for an array of customized strings. If present, use the array
// *instead of* database lookups. This is a high performance way to provide a
// handful of string replacements. See settings.php for examples.
// Cache the $custom_strings variable to improve performance.
if
(
!
isset
(
$custom_strings
))
{
$custom_strings
=
variable_get
(
'locale_custom_strings_'
.
$language
->
language
,
array
());
}
// Custom strings work for English too, even if locale module is disabled.
if
(
isset
(
$custom_strings
[
$string
]))
{
$string
=
$custom_strings
[
$string
];
}
// Translate with locale module if enabled.
elseif
(
function_exists
(
'locale'
)
&&
$language
->
language
!=
'en'
)
{
$string
=
locale
(
$string
);
}
if
(
!
$args
)
{
...
...
sites/default/settings.php
View file @
f0b273a9
...
...
@@ -164,3 +164,16 @@
# 'anonymous' => 'Visitor',
# );
/**
* String overrides:
*
* To override specific strings on your site with or without enabling locale
* module, add an entry to this list. This functionality allows you to change
* a small number of your site's default English language interface strings.
*
* Remove the leading hash signs to enable.
*/
# $conf['locale_custom_strings_en'] = array(
# 'forum' => 'Discussion board',
# '@count min' => '@count minutes',
# );
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment