[EventCalendar] EC3 + qTranslate

Marc Boivin mjsdesign at gmail.com
Sun Mar 22 14:10:37 UTC 2009


Well since this is a hack, there's really no designated place to put it.

The best place would be to create a plugin, but it would require far  
to much work for what you want to achieve. There are no hooks in EC3,  
or not that I'm aware of, so you cannot use that as the default  
behavior for rendering.  If you're always calling the calendar from  
the widgets, it's the best place to put it.

Glad it worked out.

I'm off enjoying my day now,

Cheers,

Marc

On 22-Mar-09, at 10:01 AM, ecir hana wrote:

> On Sun, Mar 22, 2009 at 2:02 PM, Marc Boivin <mjsdesign at gmail.com>  
> wrote:
>> Well in some way or another code needs to be done. You won't get  
>> the kind of
>> support you're looking for without some modification of one or both  
>> plugins
>> (Unless I'm hugely mistaken).
>>
>> By looking at qTranslate hooks it seems like it's using standard  
>> locale
>> strings.
>>
>> You could, provided that you have the required files for  
>> translating the EC3
>> calendar plugin, wrote a custom load_plugin_textdomain that would  
>> look like
>> this:
>>
>> (WARNING: THIS IS UNTESTED CODE, COMES AS-IS. DON'T USE THAT UNLESS  
>> YOU KNOW
>> WHAT YOU ARE DOING)
>>
>> /**
>>  * Loads the plugin's translated strings, with an optional custom  
>> language
>> option
>>  *
>>  * If the path is not given then it will be the root of the plugin
>> directory.
>>  * The .mo file should be named based on the domain with a dash  
>> followed by
>> a
>>  * dash, and then the locale exactly.
>>  *
>>  * @param string $domain Unique identifier for retrieving  
>> translated strings
>>  * @param string $abs_rel_path Optional. Relative path to ABSPATH  
>> of a
>> folder,
>>  *      where the .mo file resides. Deprecated, but still  
>> functional until
>> 2.7
>>  * @param string $plugin_rel_path Optional. Relative path to  
>> WP_PLUGIN_DIR.
>> This is the preferred argument to use. It takes precendence over
>> $abs_rel_path
>>  * @param string $locale Specify the local you want to load the mo  
>> file in.
>> This is used to facilitate pages with multiple locales
>>  */
>> function custom_load_plugin_textdomain($domain, $abs_rel_path =  
>> false,
>> $plugin_rel_path = false, $locale=false) {
>>        if(!$locale)
>>                $locale = get_locale();
>>
>>        if ( false !== $plugin_rel_path )
>>                $path = WP_PLUGIN_DIR . '/' .  
>> trim( $plugin_rel_path, '/');
>>        else if ( false !== $abs_rel_path)
>>                $path = ABSPATH . trim( $abs_rel_path, '/');
>>        else
>>                $path = WP_PLUGIN_DIR;
>>
>>        $mofile = $path . '/'. $domain . '-' . $locale . '.mo';
>>        load_textdomain($domain, $mofile);
>> }
>>
>> Then you could use that custom custom_load_plugin_textdomain to  
>> load EC3
>> language file with the qTranslate locale. This is UNTESTED and only a
>> concept. It requires coding, testing and more testing. But it could  
>> be a
>> solution.
>>
>> If someone feels like testing it and code the function that links  
>> qTranslate
>> and EC3, it'll be nice.
>>
>> Good luck,
>>
>> Marc
>>
>
> THANK YOU!
>
> Alright, it works! The only thing which I'm not sure about is where
> should I call that function from? Currectly, I put a single line in
> "widget-list.php" just at the top of widget():
>
> function widget($args,$instance)
> {
>  load_textdomain('ec3', WP_PLUGIN_DIR .
> '/event-calendar/languages/ec3-' . get_locale() . '.mo');
>  extract($args,EXTR_SKIP);
>  ...
> }
>
> But I'm really not sure it's the right place to call it from...?
>
> _______________________________________________
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar




More information about the EventCalendar mailing list