Support » Plugin: GlotPress » Add a custom language translation set

  • Resolved Daniel W

    (@daniel-w-1)


    Hi,

    I would like to add a translation set for a language so small it’s not in the list (it does not even has an official language code XX_yy).

    How do I add a custom translation set?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I did manage to add a language by adding this to the locales.php

    		$sw = new GP_Locale();
    		$sw->english_name = 'Sranantongo';
    		$sw->native_name = 'Sranantongo';
    		$sw->lang_code_iso_639_1 = '';
    		$sw->lang_code_iso_639_2 = 'srn';
    		$sw->wp_locale = 'srn';
    		$sw->slug = 'srn';
    		$sw->google_code = 'srn';
    		$sw->facebook_locale = 'srn';

    But this will disappear whenever there is an update for the plug.

    Is it possible to add it as a hook or something to my child themes functions instead?

    Plugin Author Greg Ross

    (@gregross)

    Sorry for the late reply, yes you can change the location of locales.php to a custom one so it doesn’t get overwritten each time an upgrade happens.

    The relevant code is in gp-config.php:

    
    if ( ! defined( 'GP_LOCALES_PATH' ) ) {
    	define( 'GP_LOCALES_PATH', GP_PATH . 'locales/' );
    }
    

    So if you set GP_LOCALES_PATH in wp-config.php to another location it won’t be overwritten.

    Of course this does also mean that you have to manually update your custom locales.php files after each upgrade if it changes.

    The next release of GP will include a hook so you can modify the locales when they are loaded.

    • This reply was modified 6 months, 2 weeks ago by Greg Ross.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Add a custom language translation set’ is closed to new replies.