Skip to content

Commit

Permalink
ECWID-122978_Alt_text_multi_language_support_on_product_page
Browse files Browse the repository at this point in the history
ECWID-122978 Add translated alt text support
  • Loading branch information
istvan-szabo-lightspeed authored Nov 8, 2023
2 parents bee1c41 + 0741997 commit 6012f38
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
!.idea/codeStyles/codeStyleConfig.xml
build/
out/
*.iml

src/test/resources/test.properties

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,13 @@ fun FetchedProduct.ProductMedia.toUpdated() = UpdatedProduct.ProductMedia(

fun FetchedProduct.ProductImage.toUpdated() = UpdatedProduct.ProductImage(
id = id,
orderBy = orderBy
orderBy = orderBy,
alt = alt?.toUpdated()
)

fun FetchedProduct.ProductImage.Alt.toUpdated() = UpdatedProduct.ProductImage.Alt(
main = main,
translated = translated
)

fun FetchedProduct.TaxInfo.toUpdated() = UpdatedProduct.TaxInfo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,14 @@ data class UpdatedProduct(

data class ProductImage(
val id: String = "0",
val orderBy: Int = 0
)
val orderBy: Int = 0,
val alt: Alt? = null
) {
data class Alt(
val main: String? = null,
val translated: LocalizedValueMap? = null
)
}

override fun getModifyKind() = ModifyKind.ReadWrite(FetchedProduct::class)
}
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,14 @@ data class FetchedProduct(
val image400pxUrl: String? = null,
val image800pxUrl: String? = null,
val image1500pxUrl: String? = null,
val imageOriginalUrl: String? = null
)
val imageOriginalUrl: String? = null,
val alt: Alt? = null
) {
data class Alt(
val main: String? = null,
val translated: LocalizedValueMap? = null
)
}

data class ProductVideo(
val id: String = "0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ val fetchedProductNullablePropertyRules: List<NullablePropertyRule<*, *>> = list
IgnoreNullable(FetchedProduct.ProductImage::image400pxUrl),
IgnoreNullable(FetchedProduct.ProductImage::image800pxUrl),
IgnoreNullable(FetchedProduct.ProductImage::imageOriginalUrl),
AllowNullable(FetchedProduct.ProductImage::alt),
AllowNullable(FetchedProduct.ProductImage.Alt::main),
AllowNullable(FetchedProduct.ProductImage.Alt::translated),
AllowNullable(FetchedProduct.ProductVideo::videoCoverId),
AllowNullable(FetchedProduct.ProductVideo::image160pxUrl),
AllowNullable(FetchedProduct.ProductVideo::image400pxUrl),
Expand Down

0 comments on commit 6012f38

Please sign in to comment.