D!"#$% 6 Ch!$for new versions at hojtsy.hu – Freely redistri
y Gábor Hojtsy –
Translates ‘Home’ ge display.
ion API e’) language used fo r pa
Core PHP translat to the Drupal.t(‘Hom
t(‘Home’) requested language. lation for
Plural Returns the proper trans
Drupal.format ral rules in
Returns the proper (count, the text based on plu
lation for the text ba ‘1 comment’, the page’s langu
($count, trans les in the ents’)
on plural ru ‘@count comm
language. can be provided,
en placements array
Optional variable realways the page language!
and language is
Optional variable re provided in this order. acters)
language code ca
n be ased on prefix char
Repla cement formats (b
value escaped with
ns using translation features Replaced with the ut.
Other PHP functio @count check_plain() for outp
format_date Translates parts
+,-$& (,--&bu. ble as long as credit is kept.
value escaped an
($tim estamp, date/time formatting. Replaced with the r (theme
'medium', ...) ted as a placeholde
interval in eholder’)).
Displays the time (‘plac
format_interva human terms.
Tr value as is, withou
) gments. Replaced with the ting. Insecure! Only
($ timestamp, ... names of the se ional format
!html any additu already sanitized your text.
provided use if yo
Formats a file size e MB, y(
tes. Translates th irectory’, arra
ize, ...) in by me moved to @d
format_size($s Example: t(‘%na y’ => $dirnam
KB and byte labels me, ‘@director
1.1 - '*.-/0
‘%na me’ => $ﬁlena
e code at the end.
an optional languag
All functions accept the installer
Translating text in
ed later y as t(), but
translation and us Works the same wa ckend. Use
Text extracted for ory ba
Module/theme nam name. uses a file+mem
and in install
.info ﬁles description; package st(‘Home’) only in the installer
profiles. No plural
Literal permission ard
hook_p erm() when provided with stand ll files and any
-! 15. 2007.
ns array syntax. Use get_t() in .insta
implementatio could run in the
other code which s ‘t’ or ‘st’
$t = get_t(); installer too. It retu nction to be
Menu item ‘title’ an en fu
hook_menu() ‘description’ keys
, wh $t (‘Home’); depending on the
l strings. t.
impl ementations provided as litera used at the momen
Log type and mes ral ur
use translation, yo le
provided as lite ll file and need to
when Remember: if you have an .insta running in the installer if your modu
u’, strings. Third parameter easily end up e get_t()!
watchdog(‘men function calls could core module in an install profile. Us
calls specifies the replacements become sa
‘Items saved’) pport.
array. No plural su
mistakes Usage of t() in a glo ST’, t(‘...’)). The
The most common e message eg. for such as define( ‘CON
type). Reuse of the sam t yet initialized at
lues, such as t($ t_message() locale system is no e is incorrect
Using dynamic va g() and drupal_se
strings to call watchdo allows t(), the later ag
Whenever you use make sure that all that time, so this us
, calls. The former dis t possible. ds to nasty perform
the above functions eady in the code is no
requires t(), so this e API functions and also lea
po ssible values are alr using the API. Always call the abov problems. Never do
l form indirection.
elsewhere in litera ovided content. directly, without
Do not translate
e API properly r module plugin su
Tools to verify you
are using th er versions have code ws. Also feel free to export a
Drupal 6.x-2 or lat revie
e API is reported in ings appear.
improper use of th ule/theme and check whether all str
rg/proje ct/potx od
http://drupal.o template for your m use t() or some
when you forgot to
nnot find mistakes e localization client has a
The potx module ca late your output. Th
ns ge. If certain
other function to tra to translate text displayed on the pa the API.
_client convenient interface , you forgot to use
http://drupal.o ing up for translation
str ings are not show