php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #54540
Patch resbundle_uresopen revision 2011-04-15 12:38 UTC by david dot zuelke at bitextender dot com

Patch resbundle_uresopen for *Languages/Translation Bug #54540

Patch version 2011-04-15 12:38 UTC

Return to Bug #54540 | Download this patch
Patch Revisions:

Developer: david.zuelke@bitextender.com

Index: resourcebundle/resourcebundle_class.c
===================================================================
--- resourcebundle/resourcebundle_class.c	(revision 310233)
+++ resourcebundle/resourcebundle_class.c	(working copy)
@@ -102,7 +102,11 @@
 
 	INTL_CHECK_LOCALE_LEN_OBJ(locale_len, return_value);
 
-	rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
+	if (fallback) {
+		rb->me = ures_open(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
+	} else {
+		rb->me = ures_openDirect(bundlename, locale, &INTL_DATA_ERROR_CODE(rb));
+	}
 
 	INTL_CTOR_CHECK_STATUS(rb, "resourcebundle_ctor: Cannot load libICU resource bundle");
 
Index: tests/resourcebundle_internal.phpt
===================================================================
--- tests/resourcebundle_internal.phpt	(revision 0)
+++ tests/resourcebundle_internal.phpt	(revision 0)
@@ -0,0 +1,19 @@
+--TEST--
+Test ResourceBundle::__construct() with internal ICU bundles
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+$b = new ResourceBundle('de_DE', 'ICUDATA-region');
+var_dump($b->get('Countries')->get('DE'));
+
+$b = new ResourceBundle('icuver', 'ICUDATA');
+var_dump($b->get('ICUVersion') !== NULL);
+
+$b = new ResourceBundle('supplementalData', 'ICUDATA', false);
+var_dump($b->get('cldrVersion') !== NULL);
+?>
+--EXPECTF--
+string(11) "Deutschland"
+bool(true)
+bool(true)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC