Hi all. For http://tracker.squeakland.org/browse/SQ-139 , I am playing with prototype of msgctxt support in Etoys and want to discuss with you about this.
Changesets: 1) trnCtxCore-KR msgctxt support for translation engine
2) transCtxSelector-KR To use selector name of method that sender of #translated and #translatedNoop as msgctxt
3) transCtxExplicit-KR #translatedWithContext: and #translatedNoopWithContext: -- variant of #translated and #translatedNoop with manually specified msgctxt
4) Using #translatedWithCtx: and #translatedNoopWithContext. ex1VocaCore-KR ex2Voca-KR ex3Sound-KR ex4Halo-KR ex5Parts-KR
**How to try it:
1) Build experimental image 1.1) Grab fresh developer image and update to the latest. 1.2) Apply changesets 1)-4) to the image 1.3) Download the latest PO file for you language from http://translate.sugarlabs.org/ 1.4) Switch locale to your language. 1.5) Open LanguageEditor and load the PO of 1.3) with "gettext import" functionality.
2) Generate PO with msgctxt Evaluate this:
GetTextExporter2 new exportTranslator: (InternalTranslator newLocaleID: LocaleID current).
Generated PO is at po/etoys/$(LANG).po under your image.
3) Save image and exit.
4) Explore and edit PO 4.1) Generated PO is like this:
#: Morphic-Kernel,_Morph>>additionsToViewerCategoryBasic msgctxt "Morph>>additionsToViewerCategoryBasic" msgid "y" msgstr " (... some translation ...)"
You could see new statement "msgctxt" with name of selector where the string is located. If same string has multiple occurrences, each has its msgctxt/msgid specification. and you could supply different translation for each occurrences.
4.2) compile MO msgfmt -o etoys.mo yourpofile and place etoys.mo to locale/$(LANG)/LC_MESSAGES under your image.
5) restart Etoys with the changes, switch to your language, and check how translation is executed.
**Manually specifying msgctxt
For some strings with #translatedNoop, #translated is applied in other location and "selector as msgctxt" doesn't work. It is needed to manually specify msgctxt. "What as msgctxt" needs to be negotiated between providers(#translatedNoopWithContext:) and consumers(#translatedWithContext:).
Source code become ugly because there are many occurrences of such use case. But I couldn't think of better idea.
/Korakurider
Hi Korakurider,
On Tue, 4 Aug 2009, Korakurider wrote:
For http://tracker.squeakland.org/browse/SQ-139 , I am playing with prototype of msgctxt support in Etoys and want to discuss with you about this.
That's great news! It will help to solve some real issues with localization.
- transCtxExplicit-KR #translatedWithContext: and #translatedNoopWithContext: -- variant of #translated and #translatedNoop with manually specified msgctxt
Just to get an idea, what an explicit message-context could be:
From my viewpoint being translator, particularly usefull msgctxt would be
- programming-tile - menu-entry - balloon-help
More technically speeking, msgctxt is necessary to identify short strings in particular uniquely within po-files. This is needed for example in order to use the suggestions-functionality on the pootle translation-server.
Markus
etoys-dev@lists.squeakfoundation.org