| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // limitations under the License. | 4 // limitations under the License. |
| 5 | 5 |
| 6 #include "src/i18n.h" | 6 #include "src/i18n.h" |
| 7 | 7 |
| 8 #include "unicode/brkiter.h" | 8 #include "unicode/brkiter.h" |
| 9 #include "unicode/calendar.h" | 9 #include "unicode/calendar.h" |
| 10 #include "unicode/coll.h" | 10 #include "unicode/coll.h" |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 icu_locale = icu::Locale(icu_result); | 697 icu_locale = icu::Locale(icu_result); |
| 698 } | 698 } |
| 699 | 699 |
| 700 icu::SimpleDateFormat* date_format = CreateICUDateFormat( | 700 icu::SimpleDateFormat* date_format = CreateICUDateFormat( |
| 701 isolate, icu_locale, options); | 701 isolate, icu_locale, options); |
| 702 if (!date_format) { | 702 if (!date_format) { |
| 703 // Remove extensions and try again. | 703 // Remove extensions and try again. |
| 704 icu::Locale no_extension_locale(icu_locale.getBaseName()); | 704 icu::Locale no_extension_locale(icu_locale.getBaseName()); |
| 705 date_format = CreateICUDateFormat(isolate, no_extension_locale, options); | 705 date_format = CreateICUDateFormat(isolate, no_extension_locale, options); |
| 706 | 706 |
| 707 if (!date_format) { |
| 708 FATAL("Failed to create ICU date format, are ICU data files missing?"); |
| 709 } |
| 710 |
| 707 // Set resolved settings (pattern, numbering system, calendar). | 711 // Set resolved settings (pattern, numbering system, calendar). |
| 708 SetResolvedDateSettings( | 712 SetResolvedDateSettings( |
| 709 isolate, no_extension_locale, date_format, resolved); | 713 isolate, no_extension_locale, date_format, resolved); |
| 710 } else { | 714 } else { |
| 711 SetResolvedDateSettings(isolate, icu_locale, date_format, resolved); | 715 SetResolvedDateSettings(isolate, icu_locale, date_format, resolved); |
| 712 } | 716 } |
| 713 | 717 |
| 714 return date_format; | 718 return date_format; |
| 715 } | 719 } |
| 716 | 720 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 } | 777 } |
| 774 | 778 |
| 775 icu::DecimalFormat* number_format = | 779 icu::DecimalFormat* number_format = |
| 776 CreateICUNumberFormat(isolate, icu_locale, options); | 780 CreateICUNumberFormat(isolate, icu_locale, options); |
| 777 if (!number_format) { | 781 if (!number_format) { |
| 778 // Remove extensions and try again. | 782 // Remove extensions and try again. |
| 779 icu::Locale no_extension_locale(icu_locale.getBaseName()); | 783 icu::Locale no_extension_locale(icu_locale.getBaseName()); |
| 780 number_format = CreateICUNumberFormat( | 784 number_format = CreateICUNumberFormat( |
| 781 isolate, no_extension_locale, options); | 785 isolate, no_extension_locale, options); |
| 782 | 786 |
| 787 if (!number_format) { |
| 788 FATAL("Failed to create ICU number format, are ICU data files missing?"); |
| 789 } |
| 790 |
| 783 // Set resolved settings (pattern, numbering system). | 791 // Set resolved settings (pattern, numbering system). |
| 784 SetResolvedNumberSettings( | 792 SetResolvedNumberSettings( |
| 785 isolate, no_extension_locale, number_format, resolved); | 793 isolate, no_extension_locale, number_format, resolved); |
| 786 } else { | 794 } else { |
| 787 SetResolvedNumberSettings(isolate, icu_locale, number_format, resolved); | 795 SetResolvedNumberSettings(isolate, icu_locale, number_format, resolved); |
| 788 } | 796 } |
| 789 | 797 |
| 790 return number_format; | 798 return number_format; |
| 791 } | 799 } |
| 792 | 800 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 } | 840 } |
| 833 icu_locale = icu::Locale(icu_result); | 841 icu_locale = icu::Locale(icu_result); |
| 834 } | 842 } |
| 835 | 843 |
| 836 icu::Collator* collator = CreateICUCollator(isolate, icu_locale, options); | 844 icu::Collator* collator = CreateICUCollator(isolate, icu_locale, options); |
| 837 if (!collator) { | 845 if (!collator) { |
| 838 // Remove extensions and try again. | 846 // Remove extensions and try again. |
| 839 icu::Locale no_extension_locale(icu_locale.getBaseName()); | 847 icu::Locale no_extension_locale(icu_locale.getBaseName()); |
| 840 collator = CreateICUCollator(isolate, no_extension_locale, options); | 848 collator = CreateICUCollator(isolate, no_extension_locale, options); |
| 841 | 849 |
| 850 if (!collator) { |
| 851 FATAL("Failed to create ICU collator, are ICU data files missing?"); |
| 852 } |
| 853 |
| 842 // Set resolved settings (pattern, numbering system). | 854 // Set resolved settings (pattern, numbering system). |
| 843 SetResolvedCollatorSettings( | 855 SetResolvedCollatorSettings( |
| 844 isolate, no_extension_locale, collator, resolved); | 856 isolate, no_extension_locale, collator, resolved); |
| 845 } else { | 857 } else { |
| 846 SetResolvedCollatorSettings(isolate, icu_locale, collator, resolved); | 858 SetResolvedCollatorSettings(isolate, icu_locale, collator, resolved); |
| 847 } | 859 } |
| 848 | 860 |
| 849 return collator; | 861 return collator; |
| 850 } | 862 } |
| 851 | 863 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 891 } | 903 } |
| 892 | 904 |
| 893 icu::BreakIterator* break_iterator = CreateICUBreakIterator( | 905 icu::BreakIterator* break_iterator = CreateICUBreakIterator( |
| 894 isolate, icu_locale, options); | 906 isolate, icu_locale, options); |
| 895 if (!break_iterator) { | 907 if (!break_iterator) { |
| 896 // Remove extensions and try again. | 908 // Remove extensions and try again. |
| 897 icu::Locale no_extension_locale(icu_locale.getBaseName()); | 909 icu::Locale no_extension_locale(icu_locale.getBaseName()); |
| 898 break_iterator = CreateICUBreakIterator( | 910 break_iterator = CreateICUBreakIterator( |
| 899 isolate, no_extension_locale, options); | 911 isolate, no_extension_locale, options); |
| 900 | 912 |
| 913 if (!break_iterator) { |
| 914 FATAL("Failed to create ICU break iterator, are ICU data files missing?"); |
| 915 } |
| 916 |
| 901 // Set resolved settings (locale). | 917 // Set resolved settings (locale). |
| 902 SetResolvedBreakIteratorSettings( | 918 SetResolvedBreakIteratorSettings( |
| 903 isolate, no_extension_locale, break_iterator, resolved); | 919 isolate, no_extension_locale, break_iterator, resolved); |
| 904 } else { | 920 } else { |
| 905 SetResolvedBreakIteratorSettings( | 921 SetResolvedBreakIteratorSettings( |
| 906 isolate, icu_locale, break_iterator, resolved); | 922 isolate, icu_locale, break_iterator, resolved); |
| 907 } | 923 } |
| 908 | 924 |
| 909 return break_iterator; | 925 return break_iterator; |
| 910 } | 926 } |
| (...skipping 14 matching lines...) Expand all Loading... |
| 925 | 941 |
| 926 | 942 |
| 927 void BreakIterator::DeleteBreakIterator( | 943 void BreakIterator::DeleteBreakIterator( |
| 928 const v8::WeakCallbackData<v8::Value, void>& data) { | 944 const v8::WeakCallbackData<v8::Value, void>& data) { |
| 929 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); | 945 DeleteNativeObjectAt<icu::BreakIterator>(data, 0); |
| 930 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); | 946 DeleteNativeObjectAt<icu::UnicodeString>(data, 1); |
| 931 DestroyGlobalHandle(data); | 947 DestroyGlobalHandle(data); |
| 932 } | 948 } |
| 933 | 949 |
| 934 } } // namespace v8::internal | 950 } } // namespace v8::internal |
| OLD | NEW |