General developer forum

 
 
Tim at Lone Pine Koala Sanctuary
Re: How to check if a localized string exist
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The 'right' way to do this is demonstrated by lib/pluginlib.php. E.g.

        if (get_string_manager()->string_exists('type_' . $type . '_plural', 'core_plugin')) {
            // for most plugin types, their names are defined in core_plugin lang file
            return get_string('type_' . $type . '_plural', 'core_plugin');

        } else ...

 
Average of ratings:Useful (1)
Picture of Federico Ghigini
Re: How to check if a localized string exist
 

Hi,
thanks for all the reply, soon I am testing it.

Tim: i have tried exactly your code, but it doesn't work. Could it be a bug?

Soon i'll post the code i'm using.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: How to check if a localized string exist
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

If you go to Admin -> Plugins -> Overview, that page works, so the code I gave works when in context.

 
Average of ratings: -
Picture of Federico Ghigini
Re: How to check if a localized string exist
 

Sorry,

probably i have misspelled some instruction.  The code posted by Tim and Matteo works great (and that code is very similar to the code in my first post).


Thanks to all!

 
Average of ratings: -