Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
simplesamlphp
Manage
Activity
Members
Labels
Plan
Jira
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Perun
Perun ProxyIdP
v1
simplesamlphp
Commits
117a02ea
Unverified
Commit
117a02ea
authored
6 years ago
by
Tim van Dijen
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Add phpdoc
parent
2cac32f5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lib/SimpleSAML/Locale/Translate.php
+25
-17
25 additions, 17 deletions
lib/SimpleSAML/Locale/Translate.php
with
25 additions
and
17 deletions
lib/SimpleSAML/Locale/Translate.php
+
25
−
17
View file @
117a02ea
...
...
@@ -19,15 +19,24 @@ class Translate
*/
private
$configuration
;
/**
* Associative array of languages.
*
* @var array
*/
private
$langtext
=
array
();
/**
* Associative array of dictionaries.
*
* @var array
*/
private
$dictionaries
=
array
();
/**
* The default dictionary.
*
* @var array|null
*/
private
$defaultDictionary
=
null
;
...
...
@@ -38,7 +47,6 @@ class Translate
*/
private
$language
;
/**
* Constructor
*
...
...
@@ -66,7 +74,6 @@ class Translate
}
}
/**
* Return the internal language object used by this translator.
*
...
...
@@ -77,7 +84,6 @@ class Translate
return
$this
->
language
;
}
/**
* This method retrieves a dictionary with the name given.
*
...
...
@@ -107,7 +113,6 @@ class Translate
return
$this
->
dictionaries
[
$name
];
}
/**
* This method retrieves a tag as an array with language => string mappings.
*
...
...
@@ -145,7 +150,6 @@ class Translate
return
$dictionary
[
$tag
];
}
/**
* Retrieve the preferred translation of a given text.
*
...
...
@@ -186,7 +190,6 @@ class Translate
throw
new
\Exception
(
'Nothing to return from translation.'
);
}
/**
* Translate the name of an attribute.
*
...
...
@@ -219,7 +222,6 @@ class Translate
return
$name
;
}
/**
* Mark a string for translation without translating it.
*
...
...
@@ -232,7 +234,6 @@ class Translate
return
$tag
;
}
/**
* Translate a tag into the current language, with a fallback to english.
*
...
...
@@ -321,7 +322,6 @@ class Translate
return
$translated
;
}
/**
* Return the string that should be used when no translation was found.
*
...
...
@@ -340,7 +340,6 @@ class Translate
}
}
/**
* Include a translation inline instead of putting translations in dictionaries. This function is recommended to be
* used ONLY for variable data, or when the translation is already provided by an external source, as a database
...
...
@@ -363,7 +362,6 @@ class Translate
$this
->
langtext
[
$tag
]
=
$translation
;
}
/**
* Include a language file from the dictionaries directory.
*
...
...
@@ -386,7 +384,6 @@ class Translate
$this
->
langtext
=
array_merge
(
$this
->
langtext
,
$lang
);
}
/**
* Read a dictionary file in JSON format.
*
...
...
@@ -419,7 +416,6 @@ class Translate
return
$lang
;
}
/**
* Read a dictionary file in PHP format.
*
...
...
@@ -441,7 +437,6 @@ class Translate
return
array
();
}
/**
* Read a dictionary file.
*
...
...
@@ -471,7 +466,13 @@ class Translate
return
array
();
}
/**
* Translate a singular text.
*
* @param string $original The string before translation.
*
* @return string The translated string.
*/
public
static
function
translateSingularGettext
(
$original
)
{
$text
=
\Gettext\BaseTranslator
::
$current
->
gettext
(
$original
);
...
...
@@ -485,7 +486,15 @@ class Translate
return
strtr
(
$text
,
is_array
(
$args
[
0
])
?
$args
[
0
]
:
$args
);
}
/**
* Translate a plural text.
*
* @param string $original The string before translation.
* @param string $plural
* @param string $value
*
* @return string The translated string.
*/
public
static
function
translatePluralGettext
(
$original
,
$plural
,
$value
)
{
$text
=
\Gettext\BaseTranslator
::
$current
->
ngettext
(
$original
,
$plural
,
$value
);
...
...
@@ -499,7 +508,6 @@ class Translate
return
strtr
(
$text
,
is_array
(
$args
[
0
])
?
$args
[
0
]
:
$args
);
}
/**
* Pick a translation from a given array of translations for the current language.
*
...
...
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