Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Add -t-x0- support

  • Loading branch information...
commit 78b7f86de918d8a67b84141567b0eb1ae19a183b 1 parent 68333d0
Akira TAGOH authored October 16, 2012
17  extensions/lt-ext-ldml-t.c
@@ -14,6 +14,7 @@
14 14
 #include "config.h"
15 15
 #endif
16 16
 
  17
+#include <ctype.h>
17 18
 #include <string.h>
18 19
 #include <libxml/xpath.h>
19 20
 #include "lt-error.h"
@@ -72,6 +73,19 @@ _lt_ext_ldml_t_lookup_type(lt_ext_ldml_t_data_t  *data,
72 73
 	s = lt_list_value(l);
73 74
 	strncpy(key, lt_string_value(s), 2);
74 75
 	key[2] = 0;
  76
+	if (lt_strcasecmp(key, "x0") == 0) {
  77
+		size_t len = strlen(subtag);
  78
+
  79
+		for (i = 0; i < len; i++) {
  80
+			if (!isalnum(subtag[i])) {
  81
+				lt_error_set(error, LT_ERR_FAIL_ON_SCANNER,
  82
+					     "subtag for -t-x0- has to be 3-8 alphanum characters but: %s", subtag);
  83
+				goto bail;
  84
+			}
  85
+		}
  86
+		retval = TRUE;
  87
+		goto bail;
  88
+	}
75 89
 
76 90
 	xml = lt_xml_new();
77 91
 	doc = lt_xml_get_cldr(xml, LT_XML_CLDR_BCP47_TRANSFORM);
@@ -120,7 +134,8 @@ _lt_ext_ldml_t_lookup_type(lt_ext_ldml_t_data_t  *data,
120 134
 		}
121 135
 	}
122 136
   bail:
123  
-	free(xpath_string);
  137
+	if (xpath_string)
  138
+		free(xpath_string);
124 139
 	if (xobj)
125 140
 		xmlXPathFreeObject(xobj);
126 141
 	if (xctxt)
6  liblangtag/lt-xml.c
@@ -366,6 +366,12 @@ lt_xml_new(void)
366 366
 			goto bail;
367 367
 		if (!_lt_xml_merge_keys(__xml, __xml->cldr_bcp47_transform, doc, &err))
368 368
 			goto bail;
  369
+		if (!lt_xml_read_cldr_bcp47(__xml, "transform_private_use.xml",
  370
+					    &doc,
  371
+					    &err))
  372
+			goto bail;
  373
+		if (!_lt_xml_merge_keys(__xml, __xml->cldr_bcp47_transform, doc, &err))
  374
+			goto bail;
369 375
 		if (!lt_xml_read_cldr_bcp47(__xml, "variant.xml",
370 376
 					    &__xml->cldr_bcp47_variant,
371 377
 					    &err))

0 notes on commit 78b7f86

Please sign in to comment.
Something went wrong with that request. Please try again.