/**
  * Generate uncategorized cats in enabled languages.
  */
 public function generate_categories_in_enabled_languages()
 {
     $default_cat_id = get_option('default_category');
     $translation_lang = fw_get_term_meta($default_cat_id, 'translation_lang', true);
     if ($translation_lang == false) {
         fw_update_term_meta($default_cat_id, 'translation_id', $default_cat_id);
         fw_update_term_meta($default_cat_id, 'translation_lang', $this->get_parent()->get_default_language_code());
     }
     $languages = $translation_lang == false ? $this->get_parent()->get_enabled_languages_without($this->get_parent()->get_default_language_code()) : $this->get_parent()->get_enabled_languages();
     foreach ($languages as $code => $lang) {
         $term_slug = 'uncategorized-' . $code;
         if (!get_term_by('slug', $term_slug, 'category') && $code != $translation_lang) {
             $data = wp_insert_term($term_slug, 'category', array('slug' => $term_slug));
             if (!is_wp_error($data)) {
                 $term_id = $data['term_id'];
                 fw_update_term_meta($term_id, 'translation_id', $default_cat_id);
                 fw_update_term_meta($term_id, 'translation_lang', $code);
             }
         }
     }
 }
 function convert_to_default_language()
 {
     $menus = wp_get_nav_menus();
     foreach ($menus as $menu) {
         fw_update_term_meta($menu->term_id, 'translation_id', $menu->term_id);
         fw_update_term_meta($menu->term_id, 'translation_lang', $this->get_parent()->get_default_language_code());
     }
 }