• 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)
Viewing 5 replies - 1 through 5 (of 5 total)

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