fauzanjeg

Temporary Fix for JNews - Frontend Translation Bug

Nov 25th, 2021 (edited)
372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. /* Temporary Fix for Bug JNews - Frontend Translation */
  2. function temporary_fix_jnews_print_alt_translation( $string, $domain, $key ) {
  3. if ( true ) { /* Temporary Fix JNews - Frontend Translation */
  4. echo esc_html( vp_option( 'jnews_translate.' . $key, $string ) );
  5. } else {
  6. esc_html_e( $string, $domain );
  7. }
  8. }
  9. /* Temporary Fix for Bug JNews - Frontend Translation */
  10. function temporary_fix_jnews_return_alt_translation( $string, $domain, $key, $escape = true ) {
  11. if ( true ) { /* Temporary Fix JNews - Frontend Translation */
  12. if ( $escape ) {
  13. return esc_html( vp_option( 'jnews_translate.' . $key, $string ) );
  14. } else {
  15. return vp_option( 'jnews_translate.' . $key, $string );
  16. }
  17. } else {
  18. if ( $escape ) {
  19. return esc_html__( $string, $domain );
  20. } else {
  21. return __( $string, $domain );
  22. }
  23. }
  24. }
  25. /* Temporary Fix for Bug JNews - Frontend Translation */
  26. function temporary_fix_jnews_frontend_translation() {
  27. remove_all_actions( 'jnews_print_translation' );
  28. add_action( 'jnews_print_translation', 'temporary_fix_jnews_print_alt_translation', null, 3 );
  29. remove_filter( 'jnews_return_translation', 'jnews_return_main_translation', 10 );
  30. add_filter( 'jnews_return_translation', 'temporary_fix_jnews_return_alt_translation', null, 4 );
  31. }
  32. add_action( 'init', 'temporary_fix_jnews_frontend_translation' );
Add Comment
Please, Sign In to add comment