diff --git a/docs/standards/php.md b/docs/standards/php.md index 4047181d5972343ea733fb69024882a310ac4954..760ead5df05196a63d4acbe173fe48b57ce64563 100644 --- a/docs/standards/php.md +++ b/docs/standards/php.md @@ -99,6 +99,24 @@ Classes and interfaces in Civi take one of two forms: Changing these can be quite difficult and can break interfaces consumed by downstream. For more discussion of `CRM_` and `Civi\`, see [The Codebase](/framework/filesystem.md). +## Localization + +Any string that will be displayed to the user should be wrapped in ts() to translate the string: + +``` +$string = ts("Hello, world!"); +``` + +Translation strings can also include placeholders for variables: + +``` +$string = ts("Membership for %1 has been updated. The membership End Date is %2.", array( + 1 => $userDisplayName, + 2 => $endDate, +)); +``` + +For more information on translation, see [Translation for Developers](/translation/developers.md). ## Scope