简体   繁体   English

Assets.xcassets XCode 11 中的图像本地化不起作用

[英]Localization of images in Assets.xcassets XCode 11 not working

I have turned localization on for several image assets in the Assets.xcassets but they aren't getting picked up.我已经为 Assets.xcassets 中的几个图像资产打开了本地化,但它们没有被拾取。

I'm using XCode 11.2.1我正在使用 XCode 11.2.1

All other localizations are working (Localizable.strings, Storyboard localizations).所有其他本地化都在工作(Localizable.strings、Storyboard 本地化)。 The images are pulled in the storyboards (Could that be the problem? Although the Storyboards that use those assets are also localized).图像被拉到情节提要中(这可能是问题吗?尽管使用这些资产的情节提要也已本地化)。

Thanks!谢谢! Jennie珍妮

I was not able to fix this, my work around was to name the image file in my Localizable.strings files and reference it in code for an image name of我无法解决这个问题,我的工作是在我的Localizable.strings文件中命名图像文件并在代码中引用它以获得图像名称

let imageName = NSLocalizedString("imageName", tableName: nil, bundle: Bundle.main, value: "", comment: "")
myImageView.image = UIImage(named: imageName)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM