Hi all!
I have some quick questions regarding proper use of #translated & friends:
1. When should you use #translatedNoop rather than #translated?
2. Should you only use #translated right after a string literal literal or it is also fine to write things such as:
(aBoolean ifTrue: ['on'] ifFalse: ['off']) translated. #('yes' 'no' 'cancel') collect: #translated. menu addTranslatedList: ...
Some examples like the above are already in the Trunk, but on the other hand, I do not know how the translator engine should find the locale strings in this case.
Thanks in advance!
Best, Christoph
--- Sent from Squeak Inbox Talk
My rule of thumb would be:
sent translated _only_ to literals.
But I don't know, really… -t
On 3. Jan 2022, at 18:21, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all!
I have some quick questions regarding proper use of #translated & friends:
When should you use #translatedNoop rather than #translated?
Should you only use #translated right after a string literal literal or it is also fine to write things such as:
(aBoolean ifTrue: ['on'] ifFalse: ['off']) translated. #('yes' 'no' 'cancel') collect: #translated. menu addTranslatedList: ...
Some examples like the above are already in the Trunk, but on the other hand, I do not know how the translator engine should find the locale strings in this case.
Thanks in advance!
Best, Christoph
Sent from Squeak Inbox Talk
#translatedNoop is used to mark a string for later translation using #translated being sent to a variable receiver.
A good example is Partsbin class>>translatedQuads: which sends #translated to a variable, with the actual string being marked for translation using #translatedNoop in all the #descriptionForPartsBin methods. This is so the actual description is stored untranslated, and only translated in the UI, using the language active at that point in time.
Vanessa
On Mon, Jan 3, 2022 at 9:22 AM christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi all!
I have some quick questions regarding proper use of #translated & friends:
When should you use #translatedNoop rather than #translated?
Should you only use #translated right after a string literal literal
or it is also fine to write things such as:
(aBoolean ifTrue: ['on'] ifFalse: ['off']) translated. #('yes' 'no' 'cancel') collect: #translated. menu addTranslatedList: ...
Some examples like the above are already in the Trunk, but on the other hand, I do not know how the translator engine should find the locale strings in this case.
Thanks in advance!
Best, Christoph
*Sent from **Squeak Inbox Talk https://github.com/hpi-swa-lab/squeak-inbox-talk*
squeak-dev@lists.squeakfoundation.org