Squeak
  links to this page:    
View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide
Squeaking in Russian
Last updated at 9:15 pm UTC on 31 August 2008
How to enable Russian support varies with the version of Squeak being used. The instructions are not interchangeable. On the good side, it's getting easier.

If you have trouble with 3.9 or 3.10, read the instructions for both, then add a section to this page explaining the problem and (if possible) how you fixed it. The steps below work seem to work consistently, but there are occasional odd glitches.

These instructions allow the display and use of Cyrillic glyphs. They do not translate the user interface into Russian.


Enabling Russian support in Squeak 3.10


Save your image, and run the VM as follows:
squeak -encoding UTF-8 -textenc UTF-8 your.image
It shouldn't hurt, and may help. Under OS X, -encoding and -textenc are (reportedly) ignored.

1) This step is mandatory on OS X, and optional on Linux.
Install the Spanish UnicodeSupport changeset. It is at http://www.nabble.com/-squeak-dev---ANN--3.10-final-is-out-tt16177390.html#a16182045 . Save the .cs changeset to a file, then do World->Open->File List and load it.

2) Get Squeak to see at least one Cyrillic font, by doing 2a or 2b.
2a) Install FreeType Plus.

OR

2b) If World -> Appearances -> System Fonts shows at least one Cyrillic font (it should if you installed 'FreeType Plus'), you can skip this step. Otherwise:
Install a font with Cyrillic support. The Microsoft core fonts at http://corefonts.sourceforge.net/ are one option. The DejaVu fonts at http://dejavu.sourceforge.net/ are another. Any TTF with Cyrillic glyphs should work.
Perhaps the easiest way to do this is to download http://map.squeak.org/accountbyid/c46c87b3-c588-4a42-bbd7-7e91b7fdda03/files/fonts-dejavu-unicode.sar , unzip it, and use World->Open->File List to load fonts from it. Do not install DejaVu fonts through SqueakMap; it will hang your image.

3) Switch your fonts
This can be done from World->Appearance->System Fonts. It's probably a good idea to change all of them, or '???' can appear unexpectedly in the place of Cyrillic.

4) Test that it has worked so far. Create a file, containing UTF-8 encoded Cyrillic - this can be done by copy/pasting a few lines from http://ru.wikipedia.org/. Then, type the following code into a workspace and 'inspect it':
(MultiByteFileStream fileNamed: '/full/path/to/your/file.txt') contents


If all has gone well, an inspector should open. Click 'self', and you should see the contents of the file correctly displayed in the font you selected as the 'default text font'. Copy/paste within Squeak may or may not work; inputting Russian characters with your keyboard may or may not work. Copy/paste to/from Squeak definitely will not work without doing the following steps.

If you don't care about copy/paste and input, you're done. Otherwise, do the following:
MczInstaller installStream:
  (HTTPSocket httpGet: 'http://www.squeaksource.com/RussianSupport/RussianSupport-dao.13.mcz' ).
Locale switchToID: (LocaleID isoLanguage: 'ru').


At this point, typing Cyrillic in Squeak and copying/pasting Cyrillic within, to, and from Squeak should work.

Platform notes

The above instructions have been tested on Linux, with the Squeak3.10.2-7179-basic image and the Squeak-3.10-1.i686-pc-linux-gnu VM. They're a mixture of advice given for 3.9 and 3.10 by Windows- and MacOS-using Squeakers (the extremely helpful 'VovaJoy' and 'yamamoto'), so should also hopefully work on those platforms.

Warnings




Enabling Russian support in Squeak 3.9


These instructions are based on http://www.progz.ru/forum/index.php?showtopic=35401 . This site is in Russian; these instructions were translated by yamamoto. This way is tested on kubuntu with 3.9 and 3.10 Squeak image versions.

So, we have a Linux and we need to install a russian support into Squeak. Let's begin.

1.First we need a last version of VM and we also need to set locale to UTF-8.

For 3.10, pre-compiled VMs should work. http://ftp.squeak.org/3.10/unix-linux/Squeak-3.10-1.i686-pc-linux-gnu.tar.gz has been tested and is ok. If you use a pre-compiled VM, you can skip the rest of this step.

To compile your own VM:
  $ svn co http://squeakvm.org/svn/squeak/trunk squeak
  $ cd squeak/platforms/unix
  $ make
  $ sudo make install


For example, the author of article in forum has a Squeak with following information about Squeak version (You can do this in your machine, if you want. You must to see something similar):
danil@danil-desktop:~/squeak-svn/platforms/unix/doc$ squeak -version
3.9-12 #3 Thu Jan 24 22:22:35 MSK 2008 gcc 4.1.2
Squeak3.9alpha of 4 July 2005 [latest update: #7021]
Linux danil-desktop 2.6.20-16-generic #2 SMP Tue Dec 18 05:45:12 UTC 2007 i686 GNU/Linux
default plugin location: /usr/local/lib/squeak/3.9-12/*.so


2. Now we need to install some required packages into Squeak. For installing you can use a SqueakMapPackageLoader or a PackageUniverseBrowser. Install a FreeType pluginfirst. Then install a FreeType plus package.

Now you need to install a last package - RussianSupport. But you can't to do this from SqueakMap, because you need a final version of it, which not published yet. Therefore you must to copy the following code into your Squeak workspace and then DoIt:
MczInstaller installStream:
  (HTTPSocket httpGet: 'http://www.squeaksource.com/RussianSupport/RussianSupport-dao.13.mcz' ).
Locale switchToID: (LocaleID isoLanguage: 'ru').


If there will be problems, you can downloading this package from http://squeaksource.com and install this by hand (from FileList).

3. At last you must to set a fonts as you like. For example you can do the following code for this:
Preferences setDefaultFonts: #(
        (setSystemFontTo:        Arial                9)
        (setListFontTo:            Arial                9)
        (setFlapsFontTo:            Accushi                12)
        (setEToysFontTo:            ArialBold            9)
        (setPaintBoxButtonFontTo:            Arial    9)
        (setMenuFontTo:            ArialBold            10)
        (setWindowTitleFontTo:    Arial                11)
        (setBalloonHelpFontTo:    Accujen                9)
        (setCodeFontTo:            Arial                9)
        (setButtonFontTo:        Georgia    9)
    )


Or you can open World Menu - Appearance - System Fonts and select a fonts.

If will be problems with copy/paste, please try to run Squeak from this string:
squeak -encoding UTF-8 -textenc UTF-8 your__squeak_image.image




Enabling Russian support in Squeak 3.8


This section describes attempt to enable displaying/editing of Russian text in Squeak using m17n features of Squeak 3.8. Russian support was then currently in alpha stage. bDo not use these instructions with 3.9 or 3.10; ttfFontReaderRefactored hangs the image in extremely nasty ways. In 3.10, this is reproducible 100% of the time./b

To enable Russian Support you need:

  1. Install unicode fonts with Russian (I suggest use of ttfFontReaderRefactored from SqueakMap)
  2. RussianSupport from SqueakMap
  3. Set unicode fonts somewhere
  4. Switch to Russian locale

Do it from workspace in squeak 3.9 on network connected machine(works with Squeak3.9a-6690, hangs when changing fonts with Squeak3.9a-6693-md5 - probably something related to bTTC speedup/bTODO3.9 ?):

Do it in workspace:/b
code

pkgUrls := #('http://kilana.unibe.ch:8888/ttfReaderRefactored/TTFSupport-Refactored-dao.13.mcz'
'http://kilana.unibe.ch:8888/RussianSupport/RussianSupport-dao.3.mcz').

pkgUrls do: [:pkgUrl | MczInstaller installStream: (HTTPSocket httpGet: pkgUrl)].
/code


band this:/b
code
"sometimes squeak hangs when new fonts are being enabled - hope this make doIt more safe."
World collapseAll.

"This will ask for font directory - point to location where your ttf files reside. It also will suggest you to enable freshly installed fonts in browsers, etc."

TTFontReader suggestBatchInstallToUser.

"This switches locale to Russian - wait a couple of seconds".
Locale switchToID: (LocaleID isoLanguage: 'ru').
/codeUploaded Image: SqueakRussian.gifTwo main issues:

1) Fonts
I failed to load unicode fonts (i.e. from windows) into stock 3.8 image - stupid me. There is TTCFontReader which seems to be designed specially for this purpose but it is broken and I couldn't find out a way to make use of it. As I didn't feel that I'll manage to get a fix from somebody else, I took TTFontReader and refactored it to the state when it is capable of load of unicode ttf files. Result is on SqueakMap:http://map1.squeakfoundation.org/sm/accountbyid/2bf29ca7-cb92-4c16-ae18-6b271117a660/package/2c1a81e1-4e86-40c8-90b5-824adc4263c5I intoduced some changes into TTCFont caching policy, which don't seem to be clean or effient, but I wanted to start somewhere. At least it works for me now - I will think about how to do it properly later.


2) Infrastructure (converters, interpreters, RussianEnvironment class)
Work in progress is on SqueakMap:http://map1.squeakfoundation.org/sm/accountbyid/2bf29ca7-cb92-4c16-ae18-6b271117a660/package/bd882147-b377-468d-a4ed-d8e864193143


One thing is unclear to me: what LanguageEnvironment class>leadingChar is needed for? Everyone seems to define it for his language, but I wonder - is it necessary for Russian? What value should it have for Russian? I set it to 0 for time being.

I had to patch Windows VM in order to make copy/paste work reliably,- without VM modification you can't copy Russian text from Squeak unless current keyboard layout is Russian. Following patch forces Windows to make better guess about clipboard contents. It is written in not very defensive way, but works without problems. Unix VM has several flags to manage conversions between VM and x windows system or os. Probably nothing to change there, but I need to grasp how it is supposed to work. LC_ALL should be set in environment to enable keyboard input for squeak. Copy/paste doesn't work at a moment - but I'll fix it for sure.


diff -c sqWin32Window.c~ sqWin32Window.c
code
2256c2256
{ HANDLE h;
{ HANDLE h, hLocale;
2258a2259
DWORDpLocale;
2271a2273
>2287a2290,2296

hLocale = GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE, sizeof(DWORD));
pLocale = (DWORD) GlobalLock(hLocale);
>pLocale = GetUserDefaultLCID();
> GlobalUnlock(hLocale);
> SetClipboardData(CF_LOCALE, hLocale);
>
2288a2298
>
2296d2305