Title: Performance issues with translation
Last modified: April 29, 2020

---

# Performance issues with translation

 *  Resolved [Benjamin Danon](https://wordpress.org/support/users/bndn/)
 * (@bndn)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/performance-issues-with-translation/)
 * The code in this plugin has some performance issues regarding translation.
 * First, it’s urgent to modify the function `ogf_fonts_array()` by moving `$weights`
   declaration before the fonts array items iteration. This makes 80 000 useless
   calls to `esc_html__()` less, which saves up to 5 sec of page loading.
 * Next, there is some design problem with this function:
    – it loads translation
   to generate a list of fonts used for the front end and not only for customization
   where translations are printed; – it loads translation of font weights for each
   fonts but these weights translations are always the same; – it is called up to
   9 times by page load and always generate the same array of fonts; – it creates
   an array from a static json file where font variants are always altered the same
   way.
 * IMHO, font weights translations should be made one time for the full list of 
   possible weights and only when the strings are printed (e.g. in the customizer).

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [Benjamin Danon](https://wordpress.org/support/users/bndn/)
 * (@bndn)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/performance-issues-with-translation/#post-12755928)
 * I found the repo. This issue is at [https://github.com/fontsplugin/plugin/issues/14](https://github.com/fontsplugin/plugin/issues/14)
 *  Plugin Author [DannyCooper](https://wordpress.org/support/users/dannycooper/)
 * (@dannycooper)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/performance-issues-with-translation/#post-12756040)
 * Hi Benjamin [@bndn](https://wordpress.org/support/users/bndn/),
 * It looks like you have identified a significant performance issue. I will investigate
   this as the highest priority.
 * Could you provide any more details on how you identified/measured this problem
   and any steps to reproduce?
 * Thanks
 *  Thread Starter [Benjamin Danon](https://wordpress.org/support/users/bndn/)
 * (@bndn)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/performance-issues-with-translation/#post-12758042)
 * Hi Danny,
 * The page took longer time to load with this plugin activated. I used xdebug profling
   and webgrind to identify the function. I just profiled the same page with and
   without the plugin and then compared the two cachegrind files with webgrind.
 *  Plugin Author [DannyCooper](https://wordpress.org/support/users/dannycooper/)
 * (@dannycooper)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/performance-issues-with-translation/#post-12763538)
 * Hi [@bndn](https://wordpress.org/support/users/bndn/),
 * As you have seen this has now been resolved. As a thank you again for the excellent
   bug report I’d like to upgrade you to Pro for free. Just email [team@fontsplugin.com](https://wordpress.org/support/topic/performance-issues-with-translation/team@fontsplugin.com?output_format=md)
   at any time and I’ll take care of that for you.
 *  Thread Starter [Benjamin Danon](https://wordpress.org/support/users/bndn/)
 * (@bndn)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/performance-issues-with-translation/#post-12763791)
 * Hi Danny,
 * Thank you for this quick fix. I noticed that there is a variable that should 
   not be printed on this line [https://github.com/fontsplugin/plugin/commit/5bb3d1e93a50b4195fdad35f8c491d84bcdcd32b#diff-c6ee84a3d5ff093620bf344fa5b64e31R153](https://github.com/fontsplugin/plugin/commit/5bb3d1e93a50b4195fdad35f8c491d84bcdcd32b#diff-c6ee84a3d5ff093620bf344fa5b64e31R153).
 * Thank you for the gift! I don’t know what features the Pro version includes. 
   There is no information about that on the plugin page and on the site. So I don’t
   know if I really need it 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Performance issues with translation’ is closed to new replies.

 * ![](https://ps.w.org/olympus-google-fonts/assets/icon-256x256.jpg?rev=2812012)
 * [Fonts Plugin | Google Fonts, Adobe Fonts & Upload Fonts](https://wordpress.org/plugins/olympus-google-fonts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/olympus-google-fonts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/olympus-google-fonts/)
 * [Active Topics](https://wordpress.org/support/plugin/olympus-google-fonts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/olympus-google-fonts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/olympus-google-fonts/reviews/)

## Tags

 * [performance](https://wordpress.org/support/topic-tag/performance/)

 * 5 replies
 * 2 participants
 * Last reply from: [Benjamin Danon](https://wordpress.org/support/users/bndn/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/performance-issues-with-translation/#post-12763791)
 * Status: resolved