Skip to content

Commit

Permalink
Add r() ability to application code, and document in TRANSLATIONS
Browse files Browse the repository at this point in the history
  • Loading branch information
slusarz committed Jan 29, 2014
1 parent d677c1b commit d73b7e8
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
16 changes: 15 additions & 1 deletion horde/docs/TRANSLATIONS
Expand Up @@ -382,7 +382,7 @@ To have your own string (e.g. that you added to config files) displayed in
several languages, you have to

1. specify your texts as gettext arguments, in English, e.g. by using the
_() function.
_() or r() function.
2. edit the translation files for the required national languages,
3. compile those translation files.

Expand Down Expand Up @@ -415,6 +415,20 @@ screen:

horde-translation make --module imp --no-compendium

"Raw" gettext strings
~~~~~~~~~~~~~~~~~~~~~

Horde provides a non-standard way to define a translatable string without
having that string translated in the code. By using the r() method, the
string will be marked as a translatable string and extracted by the Horde
translation script, but the string will not be altered in the PHP code.
Example::

$str = r("Foo");
echo $str; // Output: Foo
echo _($str); // Output: [Translation of 'Foo']


Access Keys
===========

Expand Down
7 changes: 7 additions & 0 deletions horde/lib/core.php
Expand Up @@ -29,6 +29,13 @@
exit('Register globals is enabled. Exiting.');
}

/* Translation: Horde uses r() to allow a string to be identified as a
* translatable string to the gettext extraction script, but no translation
* is done. */
if (!function_exists('r')) {
function r($msg) { return $msg; }
}

$dirname = __DIR__;

if (!defined('HORDE_BASE')) {
Expand Down

0 comments on commit d73b7e8

Please sign in to comment.