WordPress.org

GlotPress

Changeset 291


Ignore:
Timestamp:
10/21/09 05:46:08 (4 years ago)
Author:
nbachiyski
Message:

NOOP_Translations class to handle the cases we don't have a translation and be very fast

Location:
trunk
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/pomo/translations.php

    r289 r291  
    203203} 
    204204endif; 
     205 
     206if ( !class_exists( 'NOOP_Translations' ) ): 
     207/** 
     208 * Provides the same interface as Translations, but doesn't do anything 
     209 */ 
     210class NOOP_Translations { 
     211    var $entries = array(); 
     212    var $headers = array(); 
     213     
     214    function add_entry($entry) { 
     215        return true; 
     216    } 
     217 
     218    function set_header($header, $value) { 
     219    } 
     220 
     221    function set_headers(&$headers) { 
     222    } 
     223 
     224    function get_header($header) { 
     225        return false; 
     226    } 
     227 
     228    function translate_entry(&$entry) { 
     229        return false; 
     230    } 
     231 
     232    function translate($singular, $context=null) { 
     233        return $singular; 
     234    } 
     235 
     236    function select_plural_form($count) { 
     237        return 1 == $count? 0 : 1; 
     238    } 
     239 
     240    function get_plural_forms_count() { 
     241        return 2; 
     242    } 
     243 
     244    function translate_plural($singular, $plural, $count, $context = null) { 
     245            return 1 == $count? $singular : $plural; 
     246    } 
     247 
     248    function merge_with(&$other) { 
     249    } 
     250} 
     251endif; 
Note: See TracChangeset for help on using the changeset viewer.