Spread.NET 12 Windows Forms features Language Packages that enable localization of formula functions in 18 built-in languages and the creation on custom packages. Using a built-in language package requires just one line of code:
[VB]
FpSpread1.AsWorkbook().WorkbookSet.LanguagePackage = LanguagePackage.Spanish
[C#]
fpSpread1.AsWorkbook().WorkbookSet.LanguagePackage = LanguagePackage.Spanish;
The 18 built-in languages supported are Chinese, Czech, Danish, Dutch, Finnish, French, German, Hungarian, Italian, Japanese, Korean, Norwegian, Polish, Portuguese, Russian, Spanish, Swedish, and Turkish. Any of these languages can be easily applied using built-in static LanguagePackage instances as shown above.
Creating a custom language package requires implementing code to create and initialize a new LanguagePackage object for the custom localization target. You can specify localized names for each function using CreateFunctionAlias, and you can specify localized names for TRUE, FALSE, calculation error values, and structured item specifiers using MapAlias:
[VB]
Dim _languagePackage As LanguagePackage = new LanguagePackage("CustomFrench", "français")
_languagePackage.CreateFunctionAlias(BuiltinFunction.ACCRINT, "INTERET.ACC")
. . .
_languagePackage.CreateFunctionAlias(BuiltinFunction.ZTEST, "TEST.Z")
_languagePackage.MapAlias(StructuredItemSpecifiers.All, "Tout")
_languagePackage.MapAlias(StructuredItemSpecifiers.Data, "Données")
_languagePackage.MapAlias(StructuredItemSpecifiers.Headers, "En-têtes")
_languagePackage.MapAlias(StructuredItemSpecifiers.Totals, "Totaux")
_languagePackage.MapAlias(StructuredItemSpecifiers.ThisRow, "Cette ligne")
_languagePackage.MapAlias(CalcError.Name, "#NOM?")
_languagePackage.MapAlias(CalcError.Null, "#NUL!")
_languagePackage.MapAlias(CalcError.Number, "#NOMBRE!")
_languagePackage.MapAlias(CalcError.Value, "#VALEUR!")
_languagePackage.MapAlias(CalcError.GettingData, "#CHARGEMENT_DONNEES")
_languagePackage.MapAlias(True, "VRAI")
_languagePackage.MapAlias(False, "FAUX")
[C#]
LanguagePackage languagePackage = new LanguagePackage("CustomFrench", "français");
languagePackage.CreateFunctionAlias(BuiltinFunction.ACCRINT, "INTERET.ACC");
. . .
languagePackage.CreateFunctionAlias(BuiltinFunction.ZTEST, "TEST.Z");
languagePackage.MapAlias(StructuredItemSpecifiers.All, "Tout");
languagePackage.MapAlias(StructuredItemSpecifiers.Data, "Données");
languagePackage.MapAlias(StructuredItemSpecifiers.Headers, "En-têtes");
languagePackage.MapAlias(StructuredItemSpecifiers.Totals, "Totaux");
languagePackage.MapAlias(StructuredItemSpecifiers.ThisRow, "Cette ligne");
languagePackage.MapAlias(CalcError.Name, "#NOM?");
languagePackage.MapAlias(CalcError.Null, "#NUL!");
languagePackage.MapAlias(CalcError.Number, "#NOMBRE!");
languagePackage.MapAlias(CalcError.Value, "#VALEUR!");
languagePackage.MapAlias(CalcError.GettingData, "#CHARGEMENT_DONNEES");
languagePackage.MapAlias(true, "VRAI");
languagePackage.MapAlias(false, "FAUX");
The above code creates a custom language package with French names for functions, structured item specifiers, errors, and truth values. After applying that language package, all formula expressions show French names:
In future releases, the language pack feature will be enhanced to support localization of the built-in style and table style names. If you have feedback about the language pack feature, we would love to hear from you! Please send feedback to us.sales@grapecity.com with “SPREAD.NET” in the subject.
The demo sample applications for language packages are available here:
VB sample code | C# sample code
To build the demo sample applications, you will also need Spread.NET 12 Windows Forms which is available here – download your free 30-day trial today and get started developing with this powerful spreadsheet component.
For further reading about the power of Spread, please see my previous post about Creating Formula References, Names, and External Variables in .NET Spreadsheets.