Title: Adding custom languages and flags
Last modified: July 1, 2020

---

# Adding custom languages and flags

 *  Resolved [Grant McN](https://wordpress.org/support/users/grant-mcn/)
 * (@grant-mcn)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/adding-custom-languages-and-flags/)
 * Hello,
 * I am developing an African languages website and would like to use TranslatePress
   to do it but I have a few questions:
    1.  Is there a way to find out which 221 languages are covered in your [Extra Languages add-on](https://translatepress.com/docs/addons/multiple-languages/)?
       Or should I say, are any of them African languages?
    2. To [add custom languages](https://translatepress.com/docs/developers/add-custom-language/),
       do I need to add the below code and edit it for each additional language? And
       then re-upload the plugin?
 * :
 *     ```
       */
       add_filter( 'trp_wp_languages', 'trpc_add_custom_somali_language', 10, 2 );
       function trpc_add_custom_somali_language( $languages ){
   
           $lang = 'so';
   
           if( array_key_exists( $lang, $languages ) ){
               return $languages;
           }
   
           // Somali
           $languages['so'] = array( 'language' => 'so_SO', 'english_name'=> 'Somali', 'native_name' => '˜اَف صَومالي', 'iso' => array( 'so' ) );
   
           global $TRP_LANGUAGE;
   
           if( $TRP_LANGUAGE == 'so_SO' ){
               $GLOBALS['text_direction'] = 'rtl';
           }
   
           return $languages;
       }
   
       add_filter('gettext_with_context', 'trpc_somali_rtl', 10, 4);
       function trpc_somali_rtl($translated, $text, $context, $domain){
           global $TRP_LANGUAGE;
           if($text == 'ltr' && $context == "text direction" && $TRP_LANGUAGE == 'so_SO'){
               $translated = 'rtl';
           }
   
           return $translated;
       }
   
       add_filter( 'trp_flags_path', 'trpc_flags_path_somali', 10, 2 );
       function trpc_flags_path_somali( $original_flags_path,  $language_code ){
   
           // only change the folder path for the following languages:
           $languages_with_custom_flags = array( 'so_SO' );
   
           if ( in_array( $language_code, $languages_with_custom_flags ) ) {
               return  plugin_dir_url( __FILE__ ) . 'flags/' ;
           }else{
               return $original_flags_path;
           }
       }
       ```
   
 * Thanks,
 * Grant
    -  This topic was modified 5 years, 11 months ago by [Grant McN](https://wordpress.org/support/users/grant-mcn/).

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

 *  [Denis](https://wordpress.org/support/users/sdenis/)
 * (@sdenis)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/adding-custom-languages-and-flags/#post-13057910)
 * Hello Grant,
 * You have the ability to select any one of the 221 languages that we added to 
   the plugin even if you dont own the addon.
 * If you cannot find the language that you need you can add it with the code you
   already mentioned. Yes, the best approach would be to create a new “plugin” for
   each language..
 * Let me know if you manage to use the custom language in your project.
 * Kind regards,
 *  Thread Starter [Grant McN](https://wordpress.org/support/users/grant-mcn/)
 * (@grant-mcn)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/adding-custom-languages-and-flags/#post-13058049)
 * Thanks, Denis. Only one of the 221 languages you have added are useful to me.
   This means I have many custom languages to add. A new plugin for each language
   sounds excessive. Can I not replicate that code and make small changes for each
   new language and then include all of it in one “Custom African Languages” plugin?
   Does CozmoLabs do paid consulting to help with these kinds of projects (that 
   will ultimately benefit your plugin)?
 *  [Denis](https://wordpress.org/support/users/sdenis/)
 * (@sdenis)
 * [5 years, 11 months ago](https://wordpress.org/support/topic/adding-custom-languages-and-flags/#post-13058183)
 * Hello Grant,
 * You could do that. but my suggestion would be to keep it simple and create an
   addon for your secondary language.
 * Unfortunately we are not available for custom work.. but if the users keep asking
   for a language we will add it in our main plugin for sure!
 * Thanks for understanding,
 * Kind regards,

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

The topic ‘Adding custom languages and flags’ is closed to new replies.

 * ![](https://ps.w.org/translatepress-multilingual/assets/icon.svg?rev=3166541)
 * [TranslatePress - Translate Multilingual sites with AI Translation](https://wordpress.org/plugins/translatepress-multilingual/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/translatepress-multilingual/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/translatepress-multilingual/)
 * [Active Topics](https://wordpress.org/support/plugin/translatepress-multilingual/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/translatepress-multilingual/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/translatepress-multilingual/reviews/)

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Denis](https://wordpress.org/support/users/sdenis/)
 * Last activity: [5 years, 11 months ago](https://wordpress.org/support/topic/adding-custom-languages-and-flags/#post-13058183)
 * Status: resolved