Skip to content
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

Some string are slow to translate #4

Open
davidmir opened this issue Jun 23, 2016 · 3 comments
Open

Some string are slow to translate #4

davidmir opened this issue Jun 23, 2016 · 3 comments

Comments

@davidmir
Copy link

Some strings are slow to translate. Any reason for this to happen or it may be something wrong on my side?

Thanks

@danhper
Copy link
Owner

danhper commented Jun 24, 2016

Hi, thanks for reporting 😄

Would it be possible that the string is slow to translate the first time you are trying to translate it?
The translations are loaded the first time they are required, which could explain why it is slow.

Loading everything when the app is launched seems way better (I can't remember why I chose not to),
so if this seems to be your issue and you would like to send a PR, I am of course open.

If it is really an issue for you and you don't have time to send a PR, please let me know and
I will see what I can do!

If this does not seem to be your issue, it would be really nice if you could come up with a
minimal example to reproduce it.

Thanks!

@hernan0216
Copy link

hernan0216 commented Jul 3, 2020

Hi, had a similar issue in my notifications system. We build a system using async tasks to render, we get the message given a key in user.en.yml for english translation, and user.es.ym for spanish, we realized that we had some missing keys in user.es.yml. Since we render both languages the tasks were getting slowly and more slowly each time. We fix it adding the missing keys to user.es.yml but was a mess to track the notifications delay.

    async def _call(self, event):
        """
        render_message has the responsibility to identify the key and build the correct message
        to add in the notification.
        """
        .....
        for local in locales:
            i18n.set('locale', local)
            raw_text[local] = i18n.t("{}.{}".format(observer, key)). //<- here in some key doesn't exists.

@danhper
Copy link
Owner

danhper commented Aug 9, 2020

Hi, thanks for the update, and sorry for the trouble.
I think this could easily be fixed by implementing a function to eagerly load the translations at boot time but I do not have time to add this right now.
I would be very open to merging a PR for that, though.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants