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.


Top ↑

Parameters Parameters

$key

(string) (Required) Key to retrieve.


Top ↑

Return Return

(string)


Top ↑

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;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.