Thursday, October 30, 2008

Multilingual Capabilities in Gallery Server Pro

A great deal of work has gone into making Gallery Server Pro capable of displaying text in multiple languages, and I thought I would give an overview and finish up with a call for volunteers to assist with translating into other languages.

When a user navigates to a web site, most web browsers automatically send the user's preferred language to the web server with the request. Gallery Server Pro uses this setting to automatically return a web page to the user in that language. If no translation has been provided for that language, the default resource - English - is used.

For example, an English user might see a gallery like this:

menu_english

Another user in the Netherlands, whose browser is set to the Dutch language, can view the same gallery and see the resources in Dutch:

menu_dutch

A single installation of Gallery Server Pro automatically provides the correct language, without any intervention by the user. You do not need to choose one language for everyone, nor do your users need to click a special link to read the version in their language. How cool is that!

Be aware that some text in your gallery cannot be automatically served in different languages. This includes any text that is directly editable by an administrator, such as album titles and summaries, and media object titles. It is expected that you edit them directly in your preferred language.

Gallery Server Pro ships with English resources by default. Support for additional languages is provided in language packs which can be downloaded in the Language Translation forum. Deploying a language pack is as simple as copying a few files into the web application. And you can deploy as many packs as you like.

At the moment there is only a Dutch translation and a partially complete Spanish translation, and they are for an older version of Gallery Server Pro. But that is about to change, as I have just finished putting together a process that makes it very easy for volunteers to translate text into their language. I am providing a utility called the Zeta Resource Editor that lets you open two resource files side by side. To create a new translation, make a copy of the English resource file and name it according to your language. For example, the Dutch version of GalleryServerPro.resx is GalleryServerPro.nl.resx. Then you open both files in the Zeta editor:

zeta1

The two files are merged into a single grid where you can easily compare the two languages. Edit the column GalleryServerPro.nl.resx to contain the translation for the text in the column to its left (GalleryServerPro.resx). That's it. No messing around with the underlying XML or that primitive resource editor in Visual Studio.

After an initial translation is complete, it must be updated when new versions of Gallery Server Pro are released. Each resource has a date stamp for when it was last updated. The Zeta editor automatically looks for this date stamp and highlights the resources where they differ. For example, here is a screen shot of the 2.0 version of the Dutch resource when compared to the 2.1 version of the English resource:

zeta2

The yellow, green, and salmon colored cells indicate a resource that must be updated. As you update each one, the background turns white. You know you are done when all the rows are white! (FYI, the first column is always light blue.)

Translators Needed!

Gallery Server Pro is open source and supported entirely by volunteers and donations. If you are able to contribute by providing a translation in your language, we would love your help! As a thank you, I will send everyone who submits a complete translation a copy of the Dilbert book Casual Day Has Gone Too Far.

To get started with a translation, check out the Getting Started thread in the Language Translation forum.

Monday, October 27, 2008

Gallery Server Pro Version 2.1.3222 Released

This is a minor bug fix release. It contains three bug fixes:

  • (SQL Server only) Error when installing to a SQL Server database that uses a case-sensitive collation
  • Wrong resource name used in edit album popup window (only affects non-English translations)
  • Hidden files are added to the gallery during a synchronization. The synchronization code now inspects the hidden file attribute and ignores all hidden files.

Thanks to forum member KiloMike for helping identify the collation issue. This affects only SQL Server users. I had C# code and SQL in stored procedures that referred to column names that differed only by case, such as AlbumId and AlbumID. That works fine when you are using a case-insensitive collation, which is the default, at least on every installation I have ever done. But this fails in case-sensitive collations, such as SQL_Latin1_General_CP1_CS_AS. As I researched this bug, I also found an issue with the database configuration SQL script. I had originally used Visual Studio Database Edition to produce the SQL that configures the database, and it specifies the SQL_Latin1_General_CP1_CS_AS collation. That has always bothered me, because it just didn't seem right to hard code something so culture-specific. Today I discovered that I could replace these references with "COLLATE database_default", causing it to inherit the collation of the database.

Some of you will have no idea what I am talking about. No worries. The end result is that GSP will now install in more situations and you have the option of enforcing case sensitivity if you want. So, a gallery search for 'Summer Vacation' is different than 'summer vacation'. Again, I am still talking about SQL Server only. SQLite ignores case, and I am not aware of a way to change this (but I admit I haven't looked into it, either).

Finally, there is a change in how GSP synchronizes files. Starting with this release, if it encounters a file with the 'hidden' file attribute, it now ignores it. That will help with Apple OS-X users. Thanks to Ralf from Germany for this suggestion.

Instructions for upgrading are - as always - in the Administrator's Guide.

Sunday, October 19, 2008

Gallery Server Pro Version 2.1.3213 Released

I released another set of bug fixes for Gallery Server Pro. The most important of these is fixing the Silverlight issue in Firefox 3. As you may recall, while video and audio played fine in Firefox 2, it worked only intermittently in Firefox 3. The code I used was based on Silverlight 2 Beta 2, and Silverlight finally went RTM last week. I downloaded it and extracted the two javascript files from System.Web.Silverlight. That, combined with a little tweaking of the ScriptTemplate in galleryserverpro.config, and I was able to get it rock solid! Wa HOO!

The only remaining limitation with Silverlight is that it does not accept media objects streamed from the ASHX handler that GSP uses for all images, audio, video, and other media objects. When you try, you get an empty player and the Play button doesn't do anything. I will be working with Microsoft to get to the bottom of this. Meanwhile, your Silverlight templates in galleryserverpro.config must use the replacement parameters {MediaObjectAbsoluteUrlNoHandler} (for when your media objects directory is within the web application) or {MediaObjectRelativeUrlNoHandler} (for when your media objects directory is outside the web application). Do not use {MediaObjectUrl}.

There are no database changes in this release, and instructions for upgrading are - as always - in the Administrator's Guide. Here is a list of the remaining changes and bug fixes:

Updates

  • Updated to version 2008.2 SP1 of ComponentArt Web.UI
  • Updated to version 1.0.60.0 of System.Data.SQLite.dll

Bug fixes

  • Silverlight works intermittently in Firefox 3
  • Navigation error when one or more objects in album are deleted by another user
  • NullReferenceException when browsing gallery
  • Permission error when searching gallery
  • Cannot remove user from role
  • Installer does not update provider names
  • Error when logging out of my account page
  • Image metadata items added twice
  • Misleading message during a SQL Server installation

Thursday, October 2, 2008

Gallery Server Pro Version 2.1.3196 Released

Yesterday I released several bug fixes for Gallery Server Pro and updated a couple third party components. Instructions for installing and upgrading can be found in the Administrator’s Guide.

The most important fix was to address a problem with video and audio not playing in the Silverlight plug-in. When I released the Silverlight feature in August, I had tested it extensively on my internal network and, with the exception of some issues with Firefox 3, it worked great. However, after the release it became apparent that the plug-in did not work in many situations. A blue box would appear, indicating that the Silverlight control was instantiated, but the video never started.

In Gallery Server Pro, all media files – photos, video, etc – are served through an ASHX handler. This provides added security and fine tuned control over how the media is streamed to the browser. Unfortunately, the Silverlight plug-in is not behaving well with the handler, and as best I can tell the issue is with Silverlight and not the handler (when in doubt, blame the other guy, right?).

The browser requires Silverlight 1.0 or higher, but I am using javascript and a player that is distributed with the Silverlight 2.0 Beta 2 Developer Tools. When Silverlight 2.0 goes gold, I will get the latest files and try again. If it still doesn’t work, I’ll contact Microsoft for some assistance.

Meanwhile, there is an easy workaround that is implemented in this release – link directly to the media file instead of using the handler. The way to do this is to open ~/config/galleryserverpro.config and replace {MediaObjectUrl} with {MediaObjectAbsoluteUrlNoHandler} for each of the templates where Silverlight is specified (there are four). If you need more help, there are additional directions in the upgrade section in the Admin Guide. If your media objects directory is outside the Gallery Server Pro web application, you must use {MediaObjectRelativeUrlNoHandler} instead.

You may be wondering about my statement that the ASHX handler provides additional security. When you don’t use the handler, your users can view the HTML source and see something like this:

mediaSource:http://www.galleryserverpro.com/gsdemo-mediaobjects/Videos/3StrikesChipmunk_56.wmv

Anyone can copy this URL and use it to access your video any time they want. IIS happily serves the video without checking with ASP.NET (and the Gallery Server Pro user security model) to make sure the user is allowed to see it. I should note that there is a new feature in IIS 7 where you can restrict access to static files like wmv, but this feature does not provide access to the Gallery Server role/user security so it is not a viable solution.

If you are allowing anonymous users access to your gallery, then you don’t have anything to worry about, because you are not trying to restrict them anyway. I say this more as an FYI to those of you who lock down the gallery to restrict access to only logged-on users. And even then an anonymous user can get at your video only if they can guess the URL.

The Silverlight plug-in still does not reliably work in Firefox 3. Sometimes it plays the video; sometimes it doesn’t. Due to the intermittent nature it may be some kind of javascript timing issue. Microsoft has stated they will offer full support with the 2.0 release. I will keep an eye on this and release updated code as soon as I can.

This release also includes an updated version of the SQLite dll and the just-released 2008.2 ComponentArt Web.UI release. Gallery Server Pro uses many of the CA controls for enhanced UI functionality, including uploading files, the menu, tabs, and grids. Unfortunately, the new release still doesn’t fix an issue where the Add objects page becomes unusable after an upload is aborted, either through clicking Cancel during an upload or after the Upload control aborts an upload because the file exceeds the maximum limit. I am working with them to get a fix.

Below is the full list of bug fixes. If you are bored, you can read a detailed report of the bug fixes.

  • Silverlight media does not play with ASHX handler
  • Silverlight media not playing when %2b is in URL query string
  • Media objects are added in reverse order
  • Hard coded English text in web pages
  • Width and height properties not updated when small images are rotated
  • SQLite provider does not delete related data
  • Incorrect SQL in SQLiteProfileProvider
  • Records associated with anonymous users are not removed
  • SQLite DataReader closes connection during transaction
  • Web.config has <machineKey ...> element
  • Error occurs when creating an album with an empty name
  • Calendar popup appears behind edit album dialog
  • User is allowed to add an empty external object
  • SQL Server password accidentally set to encrypted
  • Invalid password attempt count too low
  • Null reference exception when session and profile are null