Question

I've got a few gettext() questions that are not covered anywhere in WordPress Codex but I think they are important.

  1. __('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?
  2. __('string', 'textdomain') in THEME should be used for strings that are theme-specific. Examples: 'this option enables X feature'. Correct?
  3. 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?
  4. Each PLUGIN should have its own textdomain: __('string', 'plugin-name'). Correct?
  5. 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').
  6. How to translate comments, dates, currencies, hours, numbers?
    1. 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).
    2. Example: nearly all themes use the_time(get_option('date_format')); - shouldn't it be echo date_i18n(get_option('date_format'), strtotime($post->post_date)); or echo date_i18n('F jS, Y'), strtotime($post->post_date));?
    3. Example: English uses 12,345.12, but some languages may use 12.345,12.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top