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