Plugin Directory

Changeset 165415


Ignore:
Timestamp:
10/21/2009 08:05:54 AM (16 years ago)
Author:
johanee
Message:

Add translation support, do not default to specific storage

Location:
cache-translation-object/trunk
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • cache-translation-object/trunk/cache-translation-object.php

    r164287 r165415  
    66  Author: Johan Eenfeldt
    77  Author URI: http://devel.kostdoktorn.se
    8   Version: 1.0
     8  Version: 1.1
    99
    1010  Copyright 2009 Johan Eenfeldt
     
    2929/*
    3030 * Todo:
    31  * - Add .pot, translate it
    3231 * - Add storage: memcached
    3332 * - check out how to handle multiple locale plugins & WPMU
     33 * register_deactivation_hook(__FILE__, 'cachet_clear_caches');
    3434 */
    3535
     
    5555$cache_translation_cached = false;
    5656
     57/* Plugin setup */
     58function cachet_init() {
     59    load_plugin_textdomain('cache-translation', false
     60                           , dirname(plugin_basename(__FILE__)));
     61}
     62add_action('plugins_loaded', 'cachet_init');
     63
    5764/* Check if caching is enabled */
    5865function cachet_is_enabled() {
     
    124131    cachet_store($l10n);
    125132}
    126 add_action('shutdown', 'cachet_action_store_translation', 10, 2);
     133add_action('shutdown', 'cachet_action_store_translation');
    127134
    128135
     
    185192/* Get current storage type */
    186193function cachet_get_type() {
    187     $type = get_option('cachet_type', false);
    188     if (!cachet_check_type($type))
    189         $type = cachet_set_default_type();
    190 
    191     return $type;
    192 }
    193 
    194 /* Set (and return) a default storage type */
    195 function cachet_set_default_type() {
    196     global $cache_translation_storage;
    197 
    198     $type = '';
    199    
    200     foreach ($cache_translation_storage as $t => $ignore) {
    201         if (cachet_storage_available($t)) {
    202             $type = $t;
    203             break;
    204         }
    205     }
    206 
    207     update_option('cachet_type', $type);
     194    $type = get_option('cachet_type', '');
     195
    208196    return $type;
    209197}
     
    330318                    echo ' (' . sprintf(__('%s bytes cached','cache-translation'), $size) . ')';
    331319                } else {
    332                     echo __('Caching disabled','cache-translation');
     320                    echo __('Enable caching','cache-translation');
    333321                }
    334322                ?>
  • cache-translation-object/trunk/readme.txt

    r164287 r165415  
    11=== Cache Translation Object ===
    22Contributors: johanee
    3 Tags: performance, translation, localization, i18n
     3Tags: cache, caching, performance, translation, localization, i18n
    44Requires at least: 2.8
    55Tested up to: 2.8.4
     
    4444= How do I make the file writable? =
    4545
    46 http://codex.wordpress.org/Changing_File_Permissions
     46`http://codex.wordpress.org/Changing_File_Permissions`
    4747
    4848The file must be writable by the webserver when using file storage.
     
    5959== Change Log ==
    6060
     61= Version 1.1 =
     62* Do not default to any specific storage type, make user choose
     63* Added plugin localization
     64* Added Swedish translation
     65
    6166= Version 1.0 =
    6267* Initial release
Note: See TracChangeset for help on using the changeset viewer.