[etoys-dev] Experimenting msgctxt supprort (SQ-139)

Korakurider korakurider at gmail.com
Mon Aug 3 12:39:13 EDT 2009

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.

	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		
				and #translatedNoopWithContext:
				-- variant of #translated and #translatedNoop
				   with manually specified msgctxt

	4) Using #translatedWithCtx: and #translatedNoopWithContext.

**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
	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

	4.2) compile MO
		msgfmt -o etoys.mo yourpofile
		and place etoys.mo to
               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.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: proto1.zip
Type: application/zip
Size: 32805 bytes
Desc: not available
Url : http://luna.immuexa.com/pipermail/etoys-dev/attachments/20090804/1a916c2a/proto1-0001.zip

More information about the etoys-dev mailing list