feat(CDA): Add asset localisation support#154
Open
OMpawar-21 wants to merge 2 commits intodevelopmentfrom
Open
feat(CDA): Add asset localisation support#154OMpawar-21 wants to merge 2 commits intodevelopmentfrom
OMpawar-21 wants to merge 2 commits intodevelopmentfrom
Conversation
Add SetLocale on Asset for single-asset fetch, Title property for localised title; AssetLibrary SetLocale unchanged. Add unit and integration tests; update CHANGELOG for 2.26.0.
Call SetLocale("en-us") first, then SetLocale("ar"), and assert "ar".
Previously the order was reversed so the test expected "ar" while the
implementation correctly kept the last value "en-us"; the assertion
was wrong. Now the test validates that the second call overwrites
the locale.
cs-raj
approved these changes
Feb 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: Asset localisation support
Summary
Adds asset localisation to the .NET CDA SDK: request assets by locale and read localised
titlefrom the response.Code changes
Contentstack.Core/Models/Asset.csTitleproperty ([JsonProperty("title")]). AddedSetLocale(string locale)for single-asset fetch by locale.Contentstack.Core/Models/AssetLibrary.csSetLocalealready supports list-by-locale).CHANGELOG.mdTest cases added
Unit (AssetLibraryUnitTests.cs)
SetLocale_ForAssetLocalisation_AddsLocaleQueryParameter–SetLocale("ar")addslocaleto query.SetLocale_UpdatesLocaleWhenCalledAgain– secondSetLocaleoverwrites the first.Unit (AssetUnitTests.cs)
SetLocale_AddsQueryParameter–Asset.SetLocale("en-us")addslocale.AddParam_WithLocale_AddsLocaleQueryParameter–AddParam("locale", "ar")addslocale.AddParam_LocaleWithIncludeFallback_AddsBothQueryParameters– locale +IncludeFallback().Integration (AssetTest.cs)
FetchAssetsWithLocale_ReturnsLocalisedAssets– list withSetLocale("en-us").FetchSingleAssetWithLocale_ReturnsLocalisedAsset– single asset viaAddParam("locale", ...).FetchSingleAssetWithSetLocale_ReturnsLocalisedAsset– single asset viaSetLocale(...).FetchAssetsWithLocaleAr_ReturnsAssetsWithLocale– list withSetLocale("ar").FetchAssetsWithLocaleAndFallback_ReturnsLocalisedOrFallback– locale +IncludeFallback().Backward compatibility
Additive only; no breaking changes.