summaryrefslogtreecommitdiff
path: root/EdkCompatibilityPkg/Compatibility/Include
diff options
context:
space:
mode:
Diffstat (limited to 'EdkCompatibilityPkg/Compatibility/Include')
-rw-r--r--EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h116
1 files changed, 116 insertions, 0 deletions
diff --git a/EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h b/EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h
new file mode 100644
index 0000000000..cc9a5d36ea
--- /dev/null
+++ b/EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h
@@ -0,0 +1,116 @@
+/** @file
+ Provides functions for language conversion between ISO 639-2 and RFC 4646 styles.
+
+Copyright (c) 2009, Intel Corporation<BR>
+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
+http://opensource.org/licenses/bsd-license.php
+
+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__
+
+/**
+ Convert an ISO 639-2 language code to a RFC 4646 language code.
+ If the ISO 639-2 language code has a corresponding ISO 639-1 code, then the ISO 639-1
+ code is returned. Else the original ISO 639-2 code is returned. The returned RFC 4646
+ language code is composed of only a primary language subtag.
+
+ If Iso639Language is NULL, then ASSERT.
+ If Rfc4646Language is NULL, then ASSERT.
+
+ @param[out] Rfc4646Language Pointers to a buffer large enough for an ASCII string
+ which reprsents a RFC 4646 language code containging only
+ either a ISO 639-1 or ISO 639-2 primary language subtag.
+ This string is Null-terminated.
+ @param[in] Iso639Language Pointer to a 3-letter ASCII string which represents
+ an ISO 639-2 language code. This string is not required
+ to be Null-terminated.
+
+ @retval TRUE The ISO 639-2 language code was converted to a ISO 639-1 code.
+ @retval FALSE The language code does not have corresponding ISO 639-1 code.
+
+**/
+BOOLEAN
+EFIAPI
+ConvertIso639ToRfc4646 (
+ OUT CHAR8 *Rfc4646Language,
+ IN CONST CHAR8 *Iso639Language
+ );
+
+/**
+ Convert a RFC 4646 language code to an ISO 639-2 language code. The primary language
+ 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.
+
+ If Rfc4646Language is NULL, then ASSERT.
+ If Iso639Language is NULL, then ASSERT.
+
+ @param[out] Iso639Language Pointers to a buffer large enough for a 3-letter ASCII string
+ which reprsents an ISO 639-2 language code. The string is Null-terminated.
+ @param[in] Rfc4646Language Pointer to a RFC 4646 language code string. This string is terminated
+ 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
+ );
+
+/**
+ Convert ISO 639-2 language codes to RFC 4646 codes and return the converted codes.
+ Caller is responsible for freeing the allocated buffer.
+
+ If Iso639Languages is NULL, then ASSERT.
+
+ @param[in] Iso639Languages Pointers to a Null-terminated ISO 639-2 language codes string containing
+ one or more ISO 639-2 3-letter language codes.
+
+ @retval NULL Invalid ISO 639-2 language code found.
+ @retval NULL Out of memory.
+ @retval !NULL 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
+ ISO 639-1 2-letter primary language subtag.
+
+**/
+CHAR8 *
+EFIAPI
+ConvertLanguagesIso639ToRfc4646 (
+ IN CONST CHAR8 *Iso639Languages
+ );
+
+/**
+ Convert RFC 4646 language codes to ISO 639-2 codes and return the converted codes.
+ 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.
+
+ @param[in] Rfc4646Languages Pointers to a Null-terminated RFC 4646 language codes string containing
+ one or more RFC 4646 language codes.
+
+ @retval NULL Invalid or unsupported RFC 4646 language code found.
+ @retval NULL Out of memory.
+ @retval !NULL 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.
+
+**/
+CHAR8 *
+EFIAPI
+ConvertLanguagesRfc4646ToIso639 (
+ IN CONST CHAR8 *Rfc4646Languages
+ );
+
+
+#endif