Xcode 本地化快把我逼疯了!不加载情节提要 [英] Xcode Localization is driving me nuts! Not loading Storyboard

查看:24
本文介绍了Xcode 本地化快把我逼疯了!不加载情节提要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题让我抓狂已经 2 天了.

It's been 2 days this issue is driving me nuts.

我正在尝试本地化我的 iOS 应用程序,但在我的一生中我无法让它工作.当我尝试一个空白项目而不是我当前的项目时,它很容易工作.

I'm trying to localize my iOS app but for the life of me I can't get it to work. It works easy enough when I try on a blank project but not on my current project.

我已经使用+"在本地化中添加了语言,我已经本地化了情节提要,但是当我检查模拟器或设备时,我仍然看到英文版本.事实上,它甚至不是英文的,因为如果我更改 Maintsoryboard(英文),我看不到设备的变化......我仍然看到最初的文本.

I've added the languages in the Localizations using "+", I've localized the storyboard but when I check on simulator or device I still see the english version. And in fact it's not even the English one because if I change the Maintsoryboard (english) I don't see the changes in the device ... I still see the initial texts.

我尝试过重置模拟器、删除应用等.没有运气.

I've tried reseting the simulator, deleted the app, etc. No luck.

我已恢复为备份尝试再次添加所有内容.没有运气.

I've reverted to a backup tried adding everything again. No luck.

有人可以帮忙吗?我知道这没什么好说的,但我不知道该解释什么来帮助你帮助我.所以如果我遗漏了一些信息,请告诉我.

Can someone please help? I know it's not much to go on, but I don't know what to explain to help you help me. So please let me know if I'm missing some info.

仅供参考,当我在 Developer 中查看应用程序的文件夹时,我最初没有 en.lproj,而我似乎应该默认拥有一个?

FYI, when I look into the app's folder in Developer, I initially don't have a en.lproj when it seems I should have one by default?

推荐答案

看起来您已经想通了,但我认为可能发生的情况是您最初将MainStoryboard.storyboard"作为未本地化的资源.这意味着当你构建你的应用程序时,你会得到一个MainStoryboard.storyboardc"作为非本地化资源.当您将故事板更改为本地化时,您会在捆绑资源中获得Base.lproj/MainStoryboard.storyboardc".

It looks like you already figured this out, but I think what probably happened is that originally you had "MainStoryboard.storyboard" as an unlocalized resource. This means that when you build your app, you get a "MainStoryboard.storyboardc" as an unlocalized resource. When you change your storyboard to be localized, you get a "Base.lproj/MainStoryboard.storyboardc" in your bundle resources.

当您在 Xcode 中构建时,您的应用有多个副本.在您的设备或模拟器中有副本,在 Xcode 的派生数据文件夹中也有一个副本.当您对应用程序进行增量构建时,Xcode 中派生数据文件夹中的副本是新内容和旧内容的合并.因此,当您在 Xcode 中修改资源并重新构建时,您将获得最新的资源.但是,当您重命名或删除资源时,旧副本仍保留在构建目录中,直到您执行清理操作.

There are several copies of your app when you're building in Xcode. There's the copy on your device or in the simulator, and there's also a copy in your derived data folder in Xcode. When you do an incremental build of your application, the copy in the derived data folder in Xcode is a merge of your new content and your old content. So, when you modify a resource in Xcode, and rebuild, you get the newest resource. However when you rename or delete resources, the old copy is still left in the build directory until you perform a clean operation.

这意味着您的构建产品可能同时具有MainStoryboard.storyboardc"和Base.lproj/MainStoryboard.storyboardc".当 NSBundle 加载资源时,它更喜欢未本地化的内容,并且会加载旧的MainStoryboard.storyboardc".

This means that your build product probably had both "MainStoryboard.storyboardc" and "Base.lproj/MainStoryboard.storyboardc". When NSBundle loads resources, it prefers unlocalized content, and would load the old "MainStoryboard.storyboardc".

这篇关于Xcode 本地化快把我逼疯了!不加载情节提要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆