Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dokuwiki
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
BRIC
dokuwiki
Commits
18ce55ed
Commit
18ce55ed
authored
11 years ago
by
Andreas Gohr
Browse files
Options
Downloads
Plain Diff
Merge pull request #251 from splitbrain/localizetemplate
Localizetemplate
parents
ff76de0a
c5c17fda
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
inc/template.php
+28
-0
28 additions, 0 deletions
inc/template.php
lib/exe/js.php
+19
-0
19 additions, 0 deletions
lib/exe/js.php
with
47 additions
and
0 deletions
inc/template.php
+
28
−
0
View file @
18ce55ed
...
...
@@ -1188,6 +1188,34 @@ function tpl_getLang($id) {
return
$lang
[
$id
];
}
/**
* Retrieve a language dependent file and pass to xhtml renderer for display
* template equivalent of p_locale_xhtml()
*
* @param string $id id of language dependent wiki page
* @return string parsed contents of the wiki page in xhtml format
*/
function
tpl_locale_xhtml
(
$id
)
{
return
p_cached_output
(
tpl_localeFN
(
$id
));
}
/**
* Prepends appropriate path for a language dependent filename
*/
function
tpl_localeFN
(
$id
)
{
$path
=
tpl_incdir
()
.
'lang/'
;
global
$conf
;
$file
=
DOKU_CONF
.
'/template_lang/'
.
$conf
[
'template'
]
.
'/'
.
$conf
[
'lang'
]
.
'/'
.
$id
.
'.txt'
;
if
(
!@
file_exists
(
$file
)){
$file
=
$path
.
$conf
[
'lang'
]
.
'/'
.
$id
.
'.txt'
;
if
(
!@
file_exists
(
$file
)){
//fall back to english
$file
=
$path
.
'en/'
.
$id
.
'.txt'
;
}
}
return
$file
;
}
/**
* prints the "main content" in the mediamanger popup
*
...
...
This diff is collapsed.
Click to expand it.
lib/exe/js.php
+
19
−
0
View file @
18ce55ed
...
...
@@ -96,6 +96,10 @@ function js_out(){
// load JS specific translations
$json
=
new
JSON
();
$lang
[
'js'
][
'plugins'
]
=
js_pluginstrings
();
$templatestrings
=
js_templatestrings
();
if
(
!
empty
(
$templatestrings
))
{
$lang
[
'js'
][
'template'
]
=
$templatestrings
;
}
echo
'LANG = '
.
$json
->
encode
(
$lang
[
'js'
])
.
";
\n
"
;
// load toolbar
...
...
@@ -210,6 +214,21 @@ function js_pluginstrings()
return
$pluginstrings
;
}
function
js_templatestrings
()
{
global
$conf
;
$templatestrings
=
array
();
if
(
@
file_exists
(
tpl_incdir
()
.
"lang/en/lang.php"
))
{
include
tpl_incdir
()
.
"lang/en/lang.php"
;
}
if
(
isset
(
$conf
[
'lang'
])
&&
$conf
[
'lang'
]
!=
'en'
&&
@
file_exists
(
tpl_incdir
()
.
"lang/"
.
$conf
[
'lang'
]
.
"/lang.php"
))
{
include
tpl_incdir
()
.
"lang/"
.
$conf
[
'lang'
]
.
"/lang.php"
;
}
if
(
isset
(
$lang
[
'js'
]))
{
$templatestrings
[
$conf
[
'template'
]]
=
$lang
[
'js'
];
}
return
$templatestrings
;
}
/**
* Escapes a String to be embedded in a JavaScript call, keeps \n
* as newline
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment