]> git.proxmox.com Git - mirror_edk2.git/blob - EdkCompatibilityPkg/Compatibility/Include/Library/LanguageLib.h
Refine language conversion in ECP. Create a new library LanguageLib providing functio...
[mirror_edk2.git] / EdkCompatibilityPkg / Compatibility / Include / Library / LanguageLib.h
1 /** @file
2 Provides functions for language conversion between ISO 639-2 and RFC 4646 styles.
3
4 Copyright (c) 2009, Intel Corporation<BR>
5 All rights reserved. This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12
13 **/
14
15 #ifndef __LANGUAGE_LIB__
16 #define __LANGUAGE_LIB__
17
18 /**
19 Convert an ISO 639-2 language code to a RFC 4646 language code.
20 If the ISO 639-2 language code has a corresponding ISO 639-1 code, then the ISO 639-1
21 code is returned. Else the original ISO 639-2 code is returned. The returned RFC 4646
22 language code is composed of only a primary language subtag.
23
24 If Iso639Language is NULL, then ASSERT.
25 If Rfc4646Language is NULL, then ASSERT.
26
27 @param[out] Rfc4646Language Pointers to a buffer large enough for an ASCII string
28 which reprsents a RFC 4646 language code containging only
29 either a ISO 639-1 or ISO 639-2 primary language subtag.
30 This string is Null-terminated.
31 @param[in] Iso639Language Pointer to a 3-letter ASCII string which represents
32 an ISO 639-2 language code. This string is not required
33 to be Null-terminated.
34
35 @retval TRUE The ISO 639-2 language code was converted to a ISO 639-1 code.
36 @retval FALSE The language code does not have corresponding ISO 639-1 code.
37
38 **/
39 BOOLEAN
40 EFIAPI
41 ConvertIso639ToRfc4646 (
42 OUT CHAR8 *Rfc4646Language,
43 IN CONST CHAR8 *Iso639Language
44 );
45
46 /**
47 Convert a RFC 4646 language code to an ISO 639-2 language code. The primary language
48 subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code. If the primary
49 language subtag is an ISO 639-1 code, then it is converted to its corresponding ISO 639-2
50 code (T code if applies). Else the ISO 639-2 code is returned.
51
52 If Rfc4646Language is NULL, then ASSERT.
53 If Iso639Language is NULL, then ASSERT.
54
55 @param[out] Iso639Language Pointers to a buffer large enough for a 3-letter ASCII string
56 which reprsents an ISO 639-2 language code. The string is Null-terminated.
57 @param[in] Rfc4646Language Pointer to a RFC 4646 language code string. This string is terminated
58 by a NULL or a ';' character.
59
60 @retval TRUE Language code converted successfully.
61 @retval FALSE The RFC 4646 language code is invalid or unsupported.
62
63 **/
64 BOOLEAN
65 EFIAPI
66 ConvertRfc4646ToIso639 (
67 OUT CHAR8 *Iso639Language,
68 IN CONST CHAR8 *Rfc4646Language
69 );
70
71 /**
72 Convert ISO 639-2 language codes to RFC 4646 codes and return the converted codes.
73 Caller is responsible for freeing the allocated buffer.
74
75 If Iso639Languages is NULL, then ASSERT.
76
77 @param[in] Iso639Languages Pointers to a Null-terminated ISO 639-2 language codes string containing
78 one or more ISO 639-2 3-letter language codes.
79
80 @retval NULL Invalid ISO 639-2 language code found.
81 @retval NULL Out of memory.
82 @retval !NULL Pointer to the allocate buffer containing the Null-terminated converted language codes string.
83 This string is composed of one or more RFC4646 language codes each of which has only
84 ISO 639-1 2-letter primary language subtag.
85
86 **/
87 CHAR8 *
88 EFIAPI
89 ConvertLanguagesIso639ToRfc4646 (
90 IN CONST CHAR8 *Iso639Languages
91 );
92
93 /**
94 Convert RFC 4646 language codes to ISO 639-2 codes and return the converted codes.
95 The primary language subtag of the RFC 4646 code must be either an ISO 639-1 or 639-2 code.
96 Caller is responsible for freeing the allocated buffer.
97
98 If Rfc4646Languages is NULL, then ASSERT.
99
100 @param[in] Rfc4646Languages Pointers to a Null-terminated RFC 4646 language codes string containing
101 one or more RFC 4646 language codes.
102
103 @retval NULL Invalid or unsupported RFC 4646 language code found.
104 @retval NULL Out of memory.
105 @retval !NULL Pointer to the allocate buffer containing the Null-terminated converted language codes string.
106 This string is composed of one or more ISO 639-2 language codes.
107
108 **/
109 CHAR8 *
110 EFIAPI
111 ConvertLanguagesRfc4646ToIso639 (
112 IN CONST CHAR8 *Rfc4646Languages
113 );
114
115
116 #endif