wp_set_lang_dir

Set the location of the language directory.

Description

wp_set_lang_dir(); 

To set directory manually, define the WP_LANG_DIR constant in wp-config.php.

If the language directory exists within WP_CONTENT_DIR,, it is used. Otherwise the language directory is assumed to live in WPINC..


Usage

  1. if ( !function_exists( 'wp_set_lang_dir' ) ) { 
  2. require_once ABSPATH . WPINC . '/load.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wp_set_lang_dir(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/load.php  
  1. function wp_set_lang_dir() { 
  2. if ( !defined( 'WP_LANG_DIR' ) ) { 
  3. if ( file_exists( WP_CONTENT_DIR . '/languages' ) && @is_dir( WP_CONTENT_DIR . '/languages' ) || !@is_dir(ABSPATH . WPINC . '/languages') ) { 
  4. /** 
  5. * Server path of the language directory. 
  6. * No leading slash, no trailing slash, full path, not relative to ABSPATH 
  7. * @since 2.1.0 
  8. */ 
  9. define( 'WP_LANG_DIR', WP_CONTENT_DIR . '/languages' ); 
  10. if ( !defined( 'LANGDIR' ) ) { 
  11. // Old static relative path maintained for limited backward compatibility - won't work in some cases. 
  12. define( 'LANGDIR', 'wp-content/languages' ); 
  13. } else { 
  14. /** 
  15. * Server path of the language directory. 
  16. * No leading slash, no trailing slash, full path, not relative to `ABSPATH`. 
  17. * @since 2.1.0 
  18. */ 
  19. define( 'WP_LANG_DIR', ABSPATH . WPINC . '/languages' ); 
  20. if ( !defined( 'LANGDIR' ) ) { 
  21. // Old relative path maintained for backward compatibility. 
  22. define( 'LANGDIR', WPINC . '/languages' );