New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trigger a system event after loading translations #8119

Closed
hypeJunction opened this Issue Apr 5, 2015 · 4 comments

Comments

Projects
None yet
3 participants
@hypeJunction
Contributor

hypeJunction commented Apr 5, 2015

It seems that plugins do not have a way to add/modify translations only when the simplecache is regenerated. I can't find a place to add some translations from database without doing unnecessary DB queries on each page load.

@beck24

This comment has been minimized.

Member

beck24 commented Apr 5, 2015

How does translation_editor handle it?

@hypeJunction

This comment has been minimized.

Contributor

hypeJunction commented Apr 7, 2015

Quick look at the code doesn't reveal any special logic. Looks like the translations are loaded on plugins boot. Maybe @jdalsem can clarify

@jdalsem

This comment has been minimized.

Member

jdalsem commented Apr 9, 2015

Translation editor stores no strings in the database, but in one big (merged) translation file that gets added to the translations during boot (there is no difference between cache on/off).

It seems that plugins do not have a way to add/modify translations only when the simplecache is regenerated

you could do:

if (elgg_is_simplecache_enabled()) {
    add_translation('en', $only_when_enabled_translations_array);
}

Or are you looking for something else?

@jdalsem

This comment has been minimized.

Member

jdalsem commented Apr 9, 2015

my bad, you only wanted when the simplecache is regenerated... there is no hook or event currently in Elgg that you can rely on to only do something during the reset of the language cache...

Maybe reloadAllTranslations could use an event trigger...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment