Copyright (c) Hyperion Entertainment and contributors.

Difference between revisions of "Locale Library"

From AmigaOS Documentation Wiki
Jump to navigation Jump to search
(Added the Locale section.)
(Reworded the introductory section.)
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
   
In today's globalized world, computer software is commonly sold and used in different countries. Each country represents a specific environment, in which certain aspects, features or behaviour of the software may not produce a desirable user experience. Therefore, modern computer applications need to be designed and adapted to respect various local conventions and customs. Your product – free or commercial – can easily get rejected by users if you fail to do so.
+
Today, computer software is commonly marketed and used globally. But programs that work for users in one country or territory may not work so well in another, because local specifics can turn certain aspects into barriers hampering usability. An obvious barrier is language but there are others. For example, an accounting program would be an utter flop if it didn't support different numeric systems and currencies. Therefore, modern computer applications need to be designed to account for various local conditions, conventions and customs. Otherwise your product – free or commercial – can easily get rejected by users.
   
 
The process of adapting software to the linguistic, cultural and technical requirements of a local market is called ''localization''. This process typically entails:
 
The process of adapting software to the linguistic, cultural and technical requirements of a local market is called ''localization''. This process typically entails:
Line 10: Line 10:
 
* use of local units of measurement, currency etc.
 
* use of local units of measurement, currency etc.
 
* use of language-specific sorting rules
 
* use of language-specific sorting rules
* use of a particular character set
+
* support for a particular character set
 
* adaptation of keyboard shortcuts (where mnemonics are desirable to be preserved)
 
* adaptation of keyboard shortcuts (where mnemonics are desirable to be preserved)
 
* etc.
 
* etc.
   
Amiga software developers are encouraged to use the Locale Library to localize their applications. Additional tools are available to help in the process.
+
Amiga software developers are encouraged to use the Locale Library to localize their applications. Additional tools are also available to help in the process.
   
 
== Locale ==
 
== Locale ==

Revision as of 08:47, 4 April 2015

Introduction

Today, computer software is commonly marketed and used globally. But programs that work for users in one country or territory may not work so well in another, because local specifics can turn certain aspects into barriers hampering usability. An obvious barrier is language but there are others. For example, an accounting program would be an utter flop if it didn't support different numeric systems and currencies. Therefore, modern computer applications need to be designed to account for various local conditions, conventions and customs. Otherwise your product – free or commercial – can easily get rejected by users.

The process of adapting software to the linguistic, cultural and technical requirements of a local market is called localization. This process typically entails:

  • translation of the application's user interface into the target language
  • translation of the application's documentation and help files into the target language
  • adaptation to specific writing conventions such as punctuation, number formatting, date and time format etc.
  • use of local units of measurement, currency etc.
  • use of language-specific sorting rules
  • support for a particular character set
  • adaptation of keyboard shortcuts (where mnemonics are desirable to be preserved)
  • etc.

Amiga software developers are encouraged to use the Locale Library to localize their applications. Additional tools are also available to help in the process.

Locale

In the context of AmigaOS, the term locale refers to a set of parameters defining various language-specific and country-specific properties. Localized Amiga software takes these properties from system files stored on disk, instead of hardcoding them into the application. Thus, no recompiling is required: properly localized Amiga applications dynamically adapt themselves to the current locale.

On the user level, locale settings for the entire operating system are made from the Locale editor in SYS:Prefs.

The programmer can access the individual locale parameters by calling OpenLocale() and then reading from the Locale structure, the pointer to which is returned as the function result. An application would normally want to query about the current system locale, which is indicated by passing NULL as parameter to OpenLocale(). The following code fragment opens the current system locale and prints the name of the associated language:

struct Locale *currentLocale;
 
if ( (currentLocale = ILocale->OpenLocale(NULL)) )
{
   IDOS->Printf("The language of this locale is %s.\n", currentLocale->loc_LanguageName);
   ILocale->CloseLocale(currentLocale);
}

Function Reference

The following table gives a brief description of the Locale Library functions. See the SDK/Autodocs for details about each call.

Function Description
CloseCatalog() Close a message catalog.
CloseLocale() Close a locale.
ConvToLower() Convert a character to lower case.
ConvToUpper() Convert a character to upper case.
FormatDate() Generate a date string based on a date formatting template.
FormatString() Format data into a character stream, assume 16bit-aligned data.
FormatString32() Format data into a character stream, assume 32bit-aligned data.
GetCatalogStr() Get a string from a message catalog.
GetLocaleStr() Get a standard string from a locale.
IsXXXX() A set of similarly-named functions to determine whether a character is of a certain type.
OpenCatalog() Open a message catalog.
OpenLocale() Open a locale.
ParseDate() Interpret a string according to the date formatting template and convert it into a DateStamp.
StrConvert() Transform a string according to collation information.
StrnCmp() Localized string comparison.