This is a dead simple patch to support in-place editing translation implementation in contrib modules. The idea is that we need a list of strings used on the page to provide a jQuery interface to aid people to translate stuff seen on the page. Two simple changes required:
- let locale() return the list of strings used on the page (in the internal static cache) => made $strings allow NULL, in which case we return the cache
- make locale() NOT to use the short string cache if need be, so we can have an exact list of strings used on the page => introduced locale_cache_short_strings variable with intentionally no UI
The idea is that a contrib module could do the following:
- in hook_boot() or hook_init() set the locale_cache_short_strings variable to zero
- in hook_exit(), collect the strings used by calling locale()
- output a JSON data structure of all strings used
- add a JS file to the page which implements an in-place translation interface
This way if that module is disabled (site in production), the dangerously disabled short string cache will be restored. I also made sure to add some warning messages to the documentation of the new variable.
This simple patch opens the door for a much wanted feature in contrib, which was on several people's agendas before.
|locale_return.patch||1.99 KB||Ignored: Check issue status.||None||None|