| | 476 | * Looks for a fallback translation file to use if locale is not available. |
| | 477 | * |
| | 478 | * @since 4.0.0 |
| | 479 | * |
| | 480 | * @param string $domain Text domain. Unique identifier for retrieving translated strings. |
| | 481 | * @param string $mofile Path to the .mo file. |
| | 482 | * @return false or string $mofile Path |
| | 483 | */ |
| | 484 | function get_fallback_translation( $mofile, $domain ) { |
| | 485 | |
| | 486 | $fallback = strtok( get_locale(), '_' ); |
| | 487 | |
| | 488 | $fallback_mofile = dirname( $mofile ) . '/' . $domain . '-' . $fallback . '.mo'; |
| | 489 | |
| | 490 | $mofile = apply_filters( 'load_textdomain_mofile', $fallback_mofile, $domain ); |
| | 491 | if ( is_readable( $mofile ) ) { |
| | 492 | return $mofile; |
| | 493 | } |
| | 494 | return false; |
| | 495 | } |
| | 496 | |
| | 497 | /** |