Closed Idomo closed 6 years ago
Why not just using:
textView.placeholder = NSLocalizedString(@"My placeholder", @"");
@devxoul It's not necessary, but it will indicate that the translation is for the placeholder and not just the word itself (this is the reason the comments are exist and required).
I mean, why should the text view translate the placeholder text?
@devxoul Oh, I did it because I'm using the IBDesginable
and this is the only way to call NSLocalizedString
from there.
Users can set translated placeholder text if they want. UITextView should not translate the given placeholder.
@devxoul Why it shouldn't? I want to use IBDesginable
to see the placeholder in the storyboard
and I want to write less unnecessary code (that I can with this change), If someone doesn't want to translate the placeholders he doesn't have to, It's shouldn't interrupting him or make him do an extra action, it just help to the ones how want to translate the placeholders.
Because it is implicit and unpredictable. UITextField
doesn't work like that. I'd like to keep the behavior as same as the UITextField
's placeholder. Imagine if the user doesn't want to translate the text when there is a same localizable string. For example:
Localizable.strings
"OK" = "확인";
MyView.swift
self.textView.placeholder = "OK" // I'd like to display 'OK' but it will translate to '확인'.
@devxoul Humm I understood now, thanks :)
Added
NSLocalizedString()
when setting the text of theplaceholderTextView
.