Xcode 9 - 本地化问题警告故事板 [英] Xcode 9 - Localization Issue Warning Storyboard

查看:159
本文介绍了Xcode 9 - 本地化问题警告故事板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在撰写本文时,我目前正在测试Xcode 9 beta 3.



查看故事板时,我收到一个警告列表,表明用其他语言/ regions我的固定约束会造成问题。



应用程序相当复杂,许多视图都遇到这些警告。



警告是:



某些自动布局约束组合可能会导致当前开发语言中的相应布局,但会引发其他语言的问题区域。



我知道该应用程序不会很快用于任何其他语言。



有没有办法关闭此警告?这听起来很傻但我不能忍受看到我的所有观点,黄色警告图标并计在顶部(110警告!)



解决方案

不需要的警告的来源是Xcode默认为故事板准备进行本地化。它们是通过使用



   

   

   




将故事板文件移出Base.lproj文件夹以防止出现警告





  &# x0020;

   

   




删除文件参考





   

   

   




重新添加故事板






   

   

   




您会看到本地化...按钮,当你成功





   

   

   




如果你想在将来进行本地化



只需点击Localize ...按钮,然后按照Xcode的提示操作即可。此外,您实际上需要解决Xcode告诉您的警告。有多种方法可以解决这些问题,我建议这样做问题开始使用。



有关此过程的视频演示,请观看屏幕录制


I am currently testing out Xcode 9 beta 3 at the time of this writing.

When viewing the storyboard I am receiving a list of warnings indicating that in other languages/regions my fixed constraint will pose an issue.

The application is fairly complex and many views are experiencing these warnings.

The warning is:

Certain autolayout constraint combinations may result in an appropriate layout in the current development language but will pose issues in other languages and regions.

I know that the app will not be used in any other languages anytime soon.

Is there any way to turn just this warning off? It sounds silly but I can not stand seeing all my views with the yellow the warning icon and count at the top (110 warnings!)

解决方案

The source of the unwanted warnings is that Xcode defaults to having storyboards "prepared" for localization. They are "prepared" by setting them up using base internationalization.

To completely disable this warning in a particular storyboard, you need to let Xcode know that the storyboard should not be considered localizable. The easiest way I was able to do this was to simply move the storyboard file from the Base.lproj folder up one level and re-add the file to the project. Once I did that, the warnings went away.

Steps

This process should work with old and new projects. Tested on Xcode 9.1 using a project created with Xcode 9.1

  1. Move the storyboard from the Base.lproj folder up one level via Finder
  2. Delete the storyboard reference from your project via Xcode
  3. Drag and drop (or otherwise re-add) the storyboard to your project
  4. Verify using the File Inspector that the storyboard no longer has base localization

     

Pictorial Walkthrough

Xcode defaults to having storyboards "prepared" for localization

     

Move your storyboard files out of the Base.lproj folder to prevent the warnings

     

Delete the file reference

     

Re-add the storyboard

     

You'll see the "Localize..." button when you've succeeded

     

If you want to localize in the future

Just tap the "Localize..." button and follow the prompts from Xcode. Additionally, you'll actually need to address the warnings that Xcode is telling you about. There are various ways to address them, I recommend this question to get started.

For a video demonstration of the process, watch this screen recording

这篇关于Xcode 9 - 本地化问题警告故事板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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