2009-05-08 03:51:35 +02:00
|
|
|
/** @file
|
|
|
|
Provides functions for language conversion between ISO 639-2 and RFC 4646 styles.
|
|
|
|
|
2010-03-13 02:03:39 +01:00
|
|
|
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved<BR>
|
2009-05-08 03:51:35 +02:00
|
|
|
All rights reserved. This program and the accompanying materials
|
|
|
|
are licensed and made available under the terms and conditions of the BSD License
|
|
|
|
which accompanies this distribution. The full text of the license may be found at
|
2010-03-13 02:03:39 +01:00
|
|
|
http://opensource.org/licenses/bsd-license.php.
|
2009-05-08 03:51:35 +02:00
|
|
|
|
|
|
|
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
|
|
|
|
**/
|
|
|
|
|
|
|
|
#ifndef __LANGUAGE_LIB__
|
|
|
|
#define __LANGUAGE_LIB__
|
|
|
|
|
|
|
|
/**
|
2009-06-18 12:52:29 +02:00
|
|
|
Converts an ISO 639-2 language code to an RFC 4646 language code.
|
|
|
|
If the ISO 639-2 language code has a corresponding ISO 639-1 code, then that ISO 639-1
|
|
|
|
code is returned in the out parameter. Else the original ISO 639-2 code is returned. The returned RFC 4646
|
2009-05-08 03:51:35 +02:00
|
|
|
language code is composed of only a primary language subtag.
|
|
|
|
|
2009-06-18 12:52:29 +02:00
|
|
|
If Iso639Language is NULL, then ASSERT().
|
|
|
|
If Rfc4646Language is NULL, then ASSERT().
|
2009-05-08 03:51:35 +02:00
|
|
|
|
|
|
|
@param[out] Rfc4646Language Pointers to a buffer large enough for an ASCII string
|
2009-06-18 12:52:29 +02:00
|
|
|
representing an RFC 4646 language code containing only
|
2009-05-08 03:51:35 +02:00
|
|
|
either a ISO 639-1 or ISO 639-2 primary language subtag.
|
|
|
|
This string is Null-terminated.
|
2010-03-13 02:03:39 +01:00
|
|
|
@param[in] Iso639Language The pointer to a 3-letter ASCII string that represents
|
2009-05-08 03:51:35 +02:00
|
|
|
an ISO 639-2 language code. This string is not required
|
|
|
|
to be Null-terminated.
|
|
|
|
|
2009-06-18 12:52:29 +02:00
|
|
|
@retval TRUE The ISO 639-2 language code was converted to an ISO 639-1 code.
|
|
|
|
@retval FALSE The language code does not have a corresponding ISO 639-1 code.
|
2009-05-08 03:51:35 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
ConvertIso639ToRfc4646 (
|
|
|
|
OUT CHAR8 *Rfc4646Language,
|
|
|
|
IN CONST CHAR8 *Iso639Language
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-06-18 12:52:29 +02:00
|
|
|
Converts an RFC 4646 language code to an ISO 639-2 language code. The primary language
|
2009-05-08 03:51:35 +02:00
|
|
|
subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code. If the primary
|
|
|
|
language subtag is an ISO 639-1 code, then it is converted to its corresponding ISO 639-2
|
|
|
|
code (T code if applies). Else the ISO 639-2 code is returned.
|
|
|
|
|
2009-06-18 12:52:29 +02:00
|
|
|
If Rfc4646Language is NULL, then ASSERT().
|
|
|
|
If Iso639Language is NULL, then ASSERT().
|
2009-05-08 03:51:35 +02:00
|
|
|
|
|
|
|
@param[out] Iso639Language Pointers to a buffer large enough for a 3-letter ASCII string
|
2010-03-13 02:03:39 +01:00
|
|
|
representing an ISO 639-2 language code. The string
|
|
|
|
is Null-terminated.
|
|
|
|
@param[in] Rfc4646Language The pointer to a RFC 4646 language code string.
|
|
|
|
This string is terminated
|
2009-05-08 03:51:35 +02:00
|
|
|
by a NULL or a ';' character.
|
|
|
|
|
|
|
|
@retval TRUE Language code converted successfully.
|
|
|
|
@retval FALSE The RFC 4646 language code is invalid or unsupported.
|
|
|
|
|
|
|
|
**/
|
|
|
|
BOOLEAN
|
|
|
|
EFIAPI
|
|
|
|
ConvertRfc4646ToIso639 (
|
|
|
|
OUT CHAR8 *Iso639Language,
|
|
|
|
IN CONST CHAR8 *Rfc4646Language
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-06-18 12:52:29 +02:00
|
|
|
Converts ISO 639-2 language codes to RFC 4646 codes and returns the converted codes.
|
2009-05-08 03:51:35 +02:00
|
|
|
Caller is responsible for freeing the allocated buffer.
|
|
|
|
|
|
|
|
If Iso639Languages is NULL, then ASSERT.
|
|
|
|
|
2009-06-18 12:52:29 +02:00
|
|
|
@param[in] Iso639Languages Pointers to Null-terminated ISO 639-2 language code strings containing
|
2009-05-08 03:51:35 +02:00
|
|
|
one or more ISO 639-2 3-letter language codes.
|
|
|
|
|
|
|
|
@retval NULL Invalid ISO 639-2 language code found.
|
|
|
|
@retval NULL Out of memory.
|
2010-03-13 02:03:39 +01:00
|
|
|
@return The pointer to the allocate buffer containing the
|
|
|
|
Null-terminated converted language codes string.
|
|
|
|
This string is composed of one or more RFC4646
|
|
|
|
language codes each of which has only
|
2009-05-08 03:51:35 +02:00
|
|
|
ISO 639-1 2-letter primary language subtag.
|
|
|
|
|
|
|
|
**/
|
|
|
|
CHAR8 *
|
|
|
|
EFIAPI
|
|
|
|
ConvertLanguagesIso639ToRfc4646 (
|
|
|
|
IN CONST CHAR8 *Iso639Languages
|
|
|
|
);
|
|
|
|
|
|
|
|
/**
|
2009-06-18 12:52:29 +02:00
|
|
|
Converts RFC 4646 language codes to ISO 639-2 codes and returns the converted codes.
|
2009-05-08 03:51:35 +02:00
|
|
|
The primary language subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code.
|
|
|
|
Caller is responsible for freeing the allocated buffer.
|
|
|
|
|
|
|
|
If Rfc4646Languages is NULL, then ASSERT.
|
|
|
|
|
2010-03-13 02:03:39 +01:00
|
|
|
@param[in] Rfc4646Languages Pointers to a Null-terminated RFC 4646 language codes
|
|
|
|
string containing one or more RFC 4646 language codes.
|
2009-05-08 03:51:35 +02:00
|
|
|
|
|
|
|
@retval NULL Invalid or unsupported RFC 4646 language code found.
|
|
|
|
@retval NULL Out of memory.
|
2010-03-13 02:03:39 +01:00
|
|
|
@return The pointer to the allocate buffer containing the
|
|
|
|
Null-terminated converted language codes string.
|
|
|
|
This string is composed of one or more ISO 639-2
|
|
|
|
language codes.
|
2009-05-08 03:51:35 +02:00
|
|
|
|
|
|
|
**/
|
|
|
|
CHAR8 *
|
|
|
|
EFIAPI
|
|
|
|
ConvertLanguagesRfc4646ToIso639 (
|
|
|
|
IN CONST CHAR8 *Rfc4646Languages
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|