public function update_site_transient( $transient ) {
		$locales = get_available_languages();
		$locales = ! empty( $locales ) ? $locales : [ get_locale() ];
		$repos   = [];

		if ( ! isset( $transient->translations ) ) {
			return $transient;
		}

		if ( 'site_transient_update_plugins' === current_filter() ) {
			$repos        = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
			$translations = wp_get_installed_translations( 'plugins' );
		}
		if ( 'site_transient_update_themes' === current_filter() ) {
			$repos        = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
			$translations = wp_get_installed_translations( 'themes' );
		}

		$repos = array_filter(
			$repos,
			function ( $e ) {
				return isset( $e->language_packs );
			}
		);

		foreach ( $repos as $repo ) {
			foreach ( $locales as $locale ) {
				$lang_pack_mod   = isset( $repo->language_packs->$locale )
					? strtotime( $repo->language_packs->$locale->updated )
					: 0;
				$translation_mod = isset( $translations[ $repo->slug ][ $locale ] )
					? strtotime( $translations[ $repo->slug ][ $locale ]['PO-Revision-Date'] )
					: 0;
				if ( $lang_pack_mod > $translation_mod ) {
					$transient->translations[] = (array) $repo->language_packs->$locale;
				}
			}
		}

		$transient->translations = array_unique( $transient->translations, SORT_REGULAR );

		return $transient;
	}
public function update_site_transient( $transient ) {
		$locales = get_available_languages();
		$locales = ! empty( $locales ) ? $locales : [ get_locale() ];
		$repos   = [];

		if ( ! isset( $transient->translations ) ) {
			return $transient;
		}

		if ( 'site_transient_update_plugins' === current_filter() ) {
			$repos        = Singleton::get_instance( 'Plugin', $this )->get_plugin_configs();
			$translations = wp_get_installed_translations( 'plugins' );
		}
		if ( 'site_transient_update_themes' === current_filter() ) {
			$repos        = Singleton::get_instance( 'Theme', $this )->get_theme_configs();
			$translations = wp_get_installed_translations( 'themes' );
		}

		$repos = array_filter(
			$repos,
			function ( $e ) {
				return isset( $e->language_packs );
			}
		);

		foreach ( $repos as $repo ) {
			foreach ( $locales as $locale ) {
				$lang_pack_mod   = isset( $repo->language_packs->$locale )
					? strtotime( $repo->language_packs->$locale->updated )
					: 0;
				$translation_mod = isset( $translations[ $repo->slug ][ $locale ] )
					? strtotime( $translations[ $repo->slug ][ $locale ]['PO-Revision-Date'] )
					: 0;
				if ( $lang_pack_mod > $translation_mod ) {
					$transient->translations[] = (array) $repo->language_packs->$locale;
				}
			}
		}

		$transient->translations = array_unique( $transient->translations, SORT_REGULAR );

		return $transient;
	}
public function update_site_transient ( $ transient ) { $ locales = get_available_languages ( ) ; $ locales = ! empty ( $ locales ) ? $ locales : [ get_locale ( ) ] ; $ repos = [ ] ; if ( ! isset ( $ transient -> translations ) ) { return $ transient ; } if ( 'site_transient_update_plugins' === current_filter ( ) ) { $ repos = Singleton :: get_instance ( 'Plugin' , $ this ) -> get_plugin_configs ( ) ; $ translations = wp_get_installed_translations ( 'plugins' ) ; } if ( 'site_transient_update_themes' === current_filter ( ) ) { $ repos = Singleton :: get_instance ( 'Theme' , $ this ) -> get_theme_configs ( ) ; $ translations = wp_get_installed_translations ( 'themes' ) ; } $ repos = array_filter ( $ repos , function ( $ e ) { return isset ( $ e -> language_packs ) ; } ) ; foreach ( $ repos as $ repo ) { foreach ( $ locales as $ locale ) { $ lang_pack_mod = isset ( $ repo -> language_packs -> $ locale ) ? strtotime ( $ repo -> language_packs -> $ locale -> updated ) : 0 ; $ translation_mod = isset ( $ translations [ $ repo -> slug ] [ $ locale ] ) ? strtotime ( $ translations [ $ repo -> slug ] [ $ locale ] [ 'PO-Revision-Date' ] ) : 0 ; if ( $ lang_pack_mod > $ translation_mod ) { $ transient -> translations [ ] = ( array ) $ repo -> language_packs -> $ locale ; } } } $ transient -> translations = array_unique ( $ transient -> translations , SORT_REGULAR ) ; return $ transient ; }
Add language translations to update_plugins or update_themes transients.

@param mixed $transient Update transient.

@return mixed
Add language translations to update_plugins or update_themes transients .