Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSLocale.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSLocale; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSArray; | |
18 import dwt.internal.cocoa.NSDictionary; | |
19 import dwt.internal.cocoa.NSObject; | |
20 import dwt.internal.cocoa.NSString; | |
21 import dwt.internal.cocoa.OS; | |
22 import objc = dwt.internal.objc.runtime; | |
23 | |
24 public class NSLocale : NSObject | |
25 { | |
26 | |
27 public this () | |
28 { | |
29 super(); | |
30 } | |
31 | |
32 public this (objc.id id) | |
33 { | |
34 super(id); | |
35 } | |
36 | |
37 public static NSArray ISOCountryCodes () | |
38 { | |
39 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_ISOCountryCodes); | |
40 return result !is null ? new NSArray(result) : null; | |
41 } | |
42 | |
43 public static NSArray ISOCurrencyCodes () | |
44 { | |
45 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_ISOCurrencyCodes); | |
46 return result !is null ? new NSArray(result) : null; | |
47 } | |
48 | |
49 public static NSArray ISOLanguageCodes () | |
50 { | |
51 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_ISOLanguageCodes); | |
52 return result !is null ? new NSArray(result) : null; | |
53 } | |
54 | |
55 public static id autoupdatingCurrentLocale () | |
56 { | |
57 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_autoupdatingCurrentLocale); | |
58 return result !is null ? new id(result) : null; | |
59 } | |
60 | |
61 public static NSArray availableLocaleIdentifiers () | |
62 { | |
63 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_availableLocaleIdentifiers); | |
64 return result !is null ? new NSArray(result) : null; | |
65 } | |
66 | |
67 public static NSString canonicalLocaleIdentifierFromString (NSString string) | |
68 { | |
69 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_canonicalLocaleIdentifierFromString_1, string !is null ? string.id : null); | |
70 return result !is null ? new NSString(result) : null; | |
71 } | |
72 | |
73 public static NSArray commonISOCurrencyCodes () | |
74 { | |
75 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_commonISOCurrencyCodes); | |
76 return result !is null ? new NSArray(result) : null; | |
77 } | |
78 | |
79 public static NSDictionary componentsFromLocaleIdentifier (NSString string) | |
80 { | |
81 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_componentsFromLocaleIdentifier_1, string !is null ? string.id : null); | |
82 return result !is null ? new NSDictionary(result) : null; | |
83 } | |
84 | |
85 public static id currentLocale () | |
86 { | |
87 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_currentLocale); | |
88 return result !is null ? new id(result) : null; | |
89 } | |
90 | |
91 public NSString displayNameForKey (id key, id value) | |
92 { | |
93 objc.id result = OS.objc_msgSend(this.id, OS.sel_displayNameForKey_1value_1, key !is null ? key.id : null, value !is null ? value.id : null); | |
94 return result !is null ? new NSString(result) : null; | |
95 } | |
96 | |
97 public id initWithLocaleIdentifier (NSString string) | |
98 { | |
99 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithLocaleIdentifier_1, string !is null ? string.id : null); | |
100 return result !is null ? new id(result) : null; | |
101 } | |
102 | |
103 public NSString localeIdentifier () | |
104 { | |
105 objc.id result = OS.objc_msgSend(this.id, OS.sel_localeIdentifier); | |
106 return result !is null ? new NSString(result) : null; | |
107 } | |
108 | |
109 public static NSString localeIdentifierFromComponents (NSDictionary dict) | |
110 { | |
111 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_localeIdentifierFromComponents_1, dict !is null ? dict.id : null); | |
112 return result !is null ? new NSString(result) : null; | |
113 } | |
114 | |
115 public id objectForKey (id key) | |
116 { | |
117 objc.id result = OS.objc_msgSend(this.id, OS.sel_objectForKey_1, key !is null ? key.id : null); | |
118 return result !is null ? new id(result) : null; | |
119 } | |
120 | |
121 public static NSArray preferredLanguages () | |
122 { | |
123 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_preferredLanguages); | |
124 return result !is null ? new NSArray(result) : null; | |
125 } | |
126 | |
127 public static id systemLocale () | |
128 { | |
129 objc.id result = OS.objc_msgSend(OS.class_NSLocale, OS.sel_systemLocale); | |
130 return result !is null ? new id(result) : null; | |
131 } | |
132 | |
133 } |