LLMS_Post_Model::translate( string $key )
Wrapper for $this-get() which allows translation of the database value before outputting on screen
Description Description
Extending classes should define this and translate any possible strings with a switch statement or something. This will return the untranslated string if a translation isn’t defined.
Parameters Parameters
- $key
-
(string) (Required) Key to retrieve.
Return Return
(string)
Source Source
File: includes/abstracts/abstract.llms.post.model.php
public function translate( $key ) {
$val = $this->get( $key );
// ******* example *******
// switch( $key ) {
// case 'example_key':
// if ( 'example-val' === $val ) {
// return translate( 'Example Key', 'lifterlms' );
// }
// break;
// default:
// return $val;
// }
// ******* example *******
return $val;
}
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
| Version | Description |
|---|---|
| 3.0.0 | Introduced. |