Gettext details
I've got a few gettext() questions that are not covered anywhere in WordPress Codex but I think they are important.
__('string')in THEME should be used for strings that are likely to be present also in main WordPress translation file. No textdomain necessary. Examples: one, two, submit, cancel, remove and other common words. Correct?__('string', 'textdomain')in THEME should be used for strings that are theme-specific. Examples: 'this option enables X feature'. Correct?- I think it's better to make one textdomain for front-end of theme and another for back-end. Like
__('string', 'textdomain')and__('string', 'textdomain-admin'). Not everyone wants to spend hours to translate 100 additional admin panel strings. Correct or it's bad practice? - Each PLUGIN should have its own textdomain:
__('string', 'plugin-name'). Correct? - I think that setting CONTEXT for THEME string is very, very useful but nobody does this. Why? Like:
_x('add item', 'add slide text', 'textdomain')and_x('add item', 'shopping cart', 'textdomain'). - How to translate comments, dates, currencies, hours, numbers?
- Example: one comment, two comments, but in some languages it may be: one comment, two comments, three commentsX, four commentsXY, five commentsXYZ, six commentsABXY (a lot more different plural forms with complex patterns).
- Example: nearly all themes use
the_time(get_option('date_format'));- shouldn't it beecho date_i18n(get_option('date_format'), strtotime($post-post_date));orecho date_i18n('F jS, Y'), strtotime($post-post_date));? - Example: English uses 12,345.12, but some languages may use 12.345,12.
Topic l10n localization translation functions plugin-wpml Wordpress
Category Web