When set the current asset group language in a particular process, the asset refers to the "source asset" and output warning log.

LogPackageLocalizationCache: Warning: Skipping the cache update for %d pending package path(s) due to a cache request from a non-game thread. Some localized packages may be missed for this query.

The following code is a workaround for updating the cache of the asset group when changing the localized language.



Adding update asset group culture cache when changing the culture.


void FPackageLocalizationCache::HandleCultureChanged()
    FScopeLock Lock(&LocalizedCachesCS);
    // Clear out all current caches and re-scan for the current culture
    const FString CurrentCultureName = FInternationalization::Get().GetCurrentLanguage()->GetName();
    CurrentCultureCache = FindOrAddCacheForCulture_NoLock(CurrentCultureName);

    if (CurrentCultureCache.IsValid())
        // We expect culture changes to happen on the game thread, so update the cache now while it is likely safe to do so
        // (ConditionalUpdateCache will internally check that this is currently the game thread before allowing the update)

// <extension>
// Adding the Culture of AssetGroupLocalization
    FInternationalization::FCultureStateSnapshot CultureStateSnapshot;
    TSet<FString> UniqueCultures;
    for (auto& AssetGroup : CultureStateSnapshot.AssetGroups)
        if (!UniqueCultures.Contains(AssetGroup.Value))
            if (TSharedPtr<FPackageLocalizationCultureCache> CultureCache = FindOrAddCacheForCulture_NoLock(AssetGroup.Value))
// </extension>


Steps to Reproduce

Repro Steps

1.  Open attached project in editor.

2.  Packaging project with Win64.

3.  Launch package application and wait around 5 sec.

(automatically process in StartupMap)

SetCurrentLanguageAndLocale(ja) -> SetCurrentLanguageAndLocale(en) -> SetCurrentLanguageAndLocale(ja) -> SetCurrentAssetGroup(en) -> OpenLevel(LocalizationMap).

4. After moving level, press Langugae button.


 Play sound source asset.


 Play sound localized asset (en).


The Asset Group (Audio) is set to "en".  So expect "en" in the Asset Group to be selected even if the current language is "ja".

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-103591 in the post.

Login to Vote

ComponentUE - Editor - UI Systems - Localization
Affects Versions4.25
Target Fix5.0
Fix Commit14850903
Release Commit16054421
CreatedNov 22, 2020
ResolvedDec 3, 2020
UpdatedNov 30, 2022