NSLocalizedStringFromTable not working in CocoaPod dependency

时间秒杀一切 提交于 2019-12-23 19:14:35

问题


I've installed REActivityViewController as a pod. Here's the picture of the Resourcesfolder in the pod:

And here's one of the lines trying to pull the strings:

    [_cancelButton setTitle:NSLocalizedStringFromTable(@"button.cancel", @"REActivityViewController", @"Cancel") forState:UIControlStateNormal];

The button titles come out not-localized. In this example it shows button.cancel. It's also not just this button title but all the buttons in this dependancy.


EDIT

So in my Main Project under Info there's this. I can't click it to see what files those are. I have NSLocalizedStrings in my main project but I have yet to create a .strings files out of them:


EDIT

So I checked my Pods-resources.sh and found this:

 install_resource "REActivityViewController/REActivityViewController/REActivityViewController.bundle"
install_resource "REActivityViewController/REActivityViewController/Localizations/de.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/en.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/fr.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/it.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/ru.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/uk.lproj"
install_resource "REActivityViewController/REActivityViewController/Localizations/zh-Hans.lproj"

回答1:


OK, I figured this out and it looks like it was somewhat isolated. I had checked the box Run script only when installing under Target -> Copy Pods Resources, because the script were painfully slow, so the script to install the bundle wasn't installing the bundle while debugging.



来源:https://stackoverflow.com/questions/21692953/nslocalizedstringfromtable-not-working-in-cocoapod-dependency

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!