Localize a view within a storyboard using “User Defined Runtime Attributes”

前端 未结 3 1084
心在旅途
心在旅途 2021-01-04 08:43

I currently have a semi-automated way to localize my views. However, today I found an interesting section in IB, which seems to suggest that I can localize my views from wit

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-04 09:30

    For me, using iOS 6, if you generate your strings from your base localized storyboard (by having XCode generate them or using the ibtool --generate-strings-file you'll get autogenerated strings that look like this (should go in MainStoryBoard.strings, for example):

    /* Class = "IBUITextField"; b4a-O4-bNZ.ibExternalUserDefinedRuntimeAttributesLocalizableStrings[0] = "Event Name"; ObjectID = "b4a-O4-bNZ"; */
    "b4a-O4-bNZ.ibExternalUserDefinedRuntimeAttributesLocalizableStrings[0]" = "Event Name";
    

    Unfortunately, it'd be nice to have them identified by the Key Path, but at least you have the location where your user defined strings should be localized.

提交回复
热议问题