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