All user visible strings in Gallery 3 are internationalized. Internationalization is the process of preparing a string so that a volunteer can translate it into their native language. Internationalized and localized strings are stored in the database, not on the filesystem.
There are two global functions used to internationalize all strings, one for singular strings and one for strings containing plural forms. Additional Localization info.
If you have a simple string that has no plural forms in it and no variables in it, then localization is very simple using the t() function. Simply pass your string in as an argument, eg:
In a controller, helper or library:
$hello_world = t("Hello, world");
In a view:
<?= t("Hello, world") ?>
If you need to craft a string with variable values in it, you can use the optional array argument to the t() function call and embed placeholders in your internationalized string. Placeholders are words prefixed by a percent (%) sign. The placeholder word matches a key in the optional array argument. You can have as many placeholders as you want. For example:
In a view:
<?= t("Hello, %name", array("name" => $user->name) ?>
In a controller, helper or library:
$info = t("%name created %title", array("name" => $user->name, "title" => $item->title));
Each locale has its own rules for plural forms and the rules get quite complicated, but to properly internationalize a string with plural forms in it, you simply have to separate the singular form of the string from the plural form and use the t2() call with the special %count variable in your internationalized string. In the singular form, you do not need to use the variable.
<?= t2("I have one apple", "I have %count apples", $count) ?>
You're also free to use plural forms with variables, for example:
$info = t2("Hey %name, you have %count apples", $count, array("name" => $user->name));
Any internationalized string you add to your module will be detected by Gallery 3 when the administrator browses to the Admin > Languages page and updates their translations. Localizers who install your module can localize your strings into their native language and upload those localizations to the Gallery website which will in turn make those localizations available to all users of the module.
Notes about internationalization:
t("See <a href=\"%url\">the documentation</a>", array("url" => "http://docs.com"))
t("%count apples and %num oranges", $count, array("num" => $num))
<?= t("I like") ?> <? if ($bacon): ?> <?= t("to eat bacon") ?> <? else: ?> <?= t("to fry eggs") ?> <? endif ?>prefer to use:
<? if ($bacon): ?> <?= t("I like to eat bacon") ?> <? else: ?> <?= t("I like to fry eggs") ?> <? endif ?>