Title: Slowdown
Last modified: October 28, 2020

---

# Slowdown

 *  [strarsis](https://wordpress.org/support/users/strarsis/)
 * (@strarsis)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/slowdown/)
 * The plugin causes quite the slowdown, even when no shortcode/widget is used on
   that page.
    For each request, a routine is called that downloads plugin translation
   data from WordPress, this can take up to half a second, slowing down everything
   significantly.
 * `find_or_initialize_translation_details` calls `retrieve_translation_details`
   on each request, apparently the caching doesn’t work.
 * Edit: It doesn’t work when the locale is `de_DE_formal`, as no such formal is
   currently available as plugin translation. However, in this case this plugin 
   should not make a request on every single WordPress request! This slows down 
   the site very noticeably.
 * Edit 2: The fix for this issue is to compare the first part of the locale (aa_BB)
   and the second part (aa_BB_[CC]) independently when determining the right locale
   set to use.
 * Modification of i18nHelper.php; function retrieve_translation_details (l. 258):
 *     ```
           private function retrieve_translation_details() {
               $branch = '/stable';
   
               $locale_id    = $this->locale;
               $locale_parts = explode( '_', $this->locale );
               $locale_slug  = 'default';
               if(count( $locale_parts ) === 3) {
                   $locale_slug = array_pop( $locale_parts );
                   $locale_id   = implode( '_', $locale_parts );
               }
   
               if (!EnvManager::is_plugin_in_production_mode()) {
                   $branch = '/dev';
               }
               $api_url = 'https://translate.wordpress.org/api/projects/wp-plugins/' . LWS_PLUGIN_SLUG . $branch;
               try {
                   Quota::verify('WordPress.org', 'GET');
                   $args = array();
                   $args['user-agent'] = LWS_PLUGIN_AGENT;
                   $args['timeout'] = get_option('live_weather_station_system_http_timeout');
                   $resp = wp_remote_get($api_url, $args);
                   $body = wp_remote_retrieve_body($resp);
                   unset($resp);
                   if ($body) {
                       $body = json_decode($body);
                       $this->cpt = 0;
                       if (isset($body)) {
                           foreach ($body->translation_sets as $set) {
                               if ($set->percent_translated >= $this->percent_min) {
                                   $this->cpt += 1;
                               }
                               if (!property_exists($set, 'wp_locale')) {
                                   continue;
                               }
                               if ($locale_id == $set->wp_locale && $locale_slug == $set->slug) {
                                   return $set;
                               }
                           }
                       }
                   }
                   return null;
               }
               catch (\Exception $e) {
                   return null;
               }
           }
       ```
   
    -  This topic was modified 5 years, 11 months ago by [strarsis](https://wordpress.org/support/users/strarsis/).
    -  This topic was modified 5 years, 11 months ago by [strarsis](https://wordpress.org/support/users/strarsis/).
    -  This topic was modified 5 years, 11 months ago by [strarsis](https://wordpress.org/support/users/strarsis/).
    -  This topic was modified 5 years, 11 months ago by [strarsis](https://wordpress.org/support/users/strarsis/).
    -  This topic was modified 5 years, 11 months ago by [strarsis](https://wordpress.org/support/users/strarsis/).
    -  This topic was modified 5 years, 11 months ago by [strarsis](https://wordpress.org/support/users/strarsis/).

 The topic ‘Slowdown’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/live-weather-station_4275b8.svg)
 * [Weather Station](https://wordpress.org/plugins/live-weather-station/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/live-weather-station/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/live-weather-station/)
 * [Active Topics](https://wordpress.org/support/plugin/live-weather-station/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/live-weather-station/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/live-weather-station/reviews/)

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [strarsis](https://wordpress.org/support/users/strarsis/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/slowdown/)
 * Status: not a support question