Stichoza / google-translate-php

🔤 Free Google Translate API PHP Package. Translates totally free of charge.
MIT License
1.79k stars 380 forks source link

Memory Usage #186

Closed nielsb02 closed 1 year ago

nielsb02 commented 1 year ago

Hi, the translator works really good, thanks!

But there is one problem when I do a lot of (mostly small text) translations, the token generator uses a lot of memory. Because of the PHP::mb_convert_encoding function.

Here is an example, I did about 500 translations which used a total of 64MB.

Version: v4.1.6

afbeelding

nielsb02 commented 1 year ago

I saw this pull request: https://github.com/Stichoza/google-translate-php/pull/145 and tried it out myself, works like a charm! Thanks WinterSilence.

Stichoza commented 1 year ago

Hello! Can you provide the full example of code?

Stichoza commented 1 year ago

145 is merged

nielsb02 commented 1 year ago

Hi, didn't see your response but I simply used the token generator file of this pull request as a custom token generator. Thank you for merging tho!