Plurals File dialog format filters

Many platform contain file dialogs that you can use to select a file to be opened and specifiy the file to be saved. The dialog contains Filter property that specifies file typed shown in the file type combo box.

For example if the original filter string is

All supported files (*.xml;*.ini)|*.xml;*.ini|XML files (*.xml)|*.xml|Ini files (*.ini)|*.ini

Then the following translation will pass.

Kaikki tuetut tiedostot (*.xml;*.ini)|*.xml;*.ini|XML tiedostot (*.xml)|*.xml|Ini tiedostot (*.ini)|*.ini

This is because the even the description strings are different the structure is the same. The translation has all supported files part, XML part and Ini part. Also each part has the same file masks (e.g. *.xml). However the following translations will fail.

Translation Reason to fail
Kaikki tuetut tiedostot (*.xml;*.ini)|*.xml;*.ini|XML tiedostot (*.xml)|*.xml|Ini tiedostot (*.ini) *.ini There is no | character between Ini description and the Ini mask.
Kaikki tuetut tiedostot (*.xml;*.ini)|*.xml;*.ini|XML tiedostot (*.xml)|*.xml There is no Ini part.
Kaikki tuetut tiedostot (*.xml;*.ini)|*.xml;*.ini|XML tiedostot (*.xml)|*.xml|Ini tiedostot (*.ini) *.ini| There is an extra | character.

You have two choices to make sure that localized values are valid. The recommended choise is to use filter string formatter class. Soluling contains filter string formatter classes for following platforms:

Platforms APIs Samples
.NET <data-dir>\Library\NET\DialogFilter.cs <data-dir>\Samples\WindowsForms\FileDialog
<data-dir>\Samples\WPF\FileDialog
Delphi <data-dir>\Library\Delphi\NtDialog.pas <data-dir>\Samples\Delphi\VCL\FileDialog
<data-dir>\Samples\Delphi\FMX\FileDialog

If your platform is not supported then the second choise is to use file dialog filter validation.