WPML
状态
等待作者
相关插件/主题
NextGen Gallery
主题标签
Compatibility

问题概述

如果您正在使用NextGen Gallery Pro相册,您会发现图库标题在次要语言中未被正确翻译。

临时解决方法

在继续操作之前,请确保对您的站点进行完整备份


  • 打开 …/wp-content/plugins/nextgen-gallery-pro/templates/DisplayTypes/Albums/default.php 文件。

  • 找到第 51 行。

  • 替换:
    							<?php print wp_kses( $entity->title, ImagelyNGGDisplayI18N::get_kses_allowed_html() ); ?>

  • 替换为:
    							<?php 
    								// WPML Workaround for compsupp-7540
    								if (class_exists('Sitepress')) {
    									$string = $entity->title;
    									$textdomain = 'WordPress';
    									$string_name = 'WPML Workaround: '.substr($string, 0, 20);
    							
    									$wpml_default_lang = apply_filters('wpml_default_language', NULL );
    									$wpml_current_lang = apply_filters( 'wpml_current_language', NULL );
    							
    									if ($wpml_default_lang == $wpml_current_lang ) {
    										do_action( 'wpml_register_single_string', $textdomain, $string_name, $string );
    									}   
    									// Apply the translation to the string
    									$entity->title = apply_filters('wpml_translate_single_string', $string , $textdomain, $string_name);
    								}
    							?>
    							<?php print wp_kses( $entity->title, ImagelyNGGDisplayI18N::get_kses_allowed_html() ); ?>
  • 访问您添加了相册的前端页面。
  • 前往 WPML > 字符串翻译,然后翻译新字符串。

所有已知问题 →