NSLocalizedString shows raw key instead of loading a string from another language

前端 未结 2 2027
温柔的废话
温柔的废话 2021-01-13 04:48

I\'m having trouble using NSLocalizedString(key, comment: \"\") to load strings from Localizable.strings when the key is missing for the current language. NSLoc

2条回答
  •  时光取名叫无心
    2021-01-13 05:35

    No, the documentation for NSLocalizedString(key,comment) is pretty clear -

    The initial value for key in the strings file will be key. Use the NSLocalizedStringWithDefaultValue macro to specify another value for key.

    What else would you expect it to return? The code simply looks up the key in a dictionary. It has no idea what message is associated with the key, let alone how to translate that message into Russian.

提交回复
热议问题