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 > 文字列翻訳に移動し、新しい文字列を翻訳します。

すべての既知の問題 →