Overview
Comment: | Use LC_MESSAGES locale for messages |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
3d5b88d42eb08747ed4c54bd615d6922 |
User & Date: | js on 2017-04-09 20:50:59 |
Other Links: | manifest | tags |
Context
2017-04-13
| ||
12:57 | OFSandbox: Don't waste memory on bools check-in: 0fc70a4510 user: js tags: trunk | |
2017-04-09
| ||
20:50 | Use LC_MESSAGES locale for messages check-in: 3d5b88d42e user: js tags: trunk | |
18:26 | platform.h: Add OF_FREEBSD and OF_OPENBSD check-in: cd47d59676 user: js tags: trunk | |
Changes
Modified src/OFApplication.m from [4ef7cfc06b] to [ec8cf68d84].
︙ | |||
111 112 113 114 115 116 117 | 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 | - + | { id <OFApplicationDelegate> delegate; #ifdef OF_WINDOWS wchar_t **wargv, **wenvp; int wargc, si = 0; #endif |
︙ |
Modified src/OFLocalization.h from [9465b8ba1c] to [93f8b830ad].
︙ | |||
41 42 43 44 45 46 47 | 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | - + - + - + - + - | of_string_encoding_t _encoding; OFString *_decimalPoint; OFMutableArray OF_GENERIC(OFDictionary OF_GENERIC(OFString*, id)*) *_localizedStrings; } /** |
︙ | |||
129 130 131 132 133 134 135 136 137 138 139 140 | 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | + + - - - + | * @param path The path to the directory to scan for language files */ + (void)addLanguageDirectory: (OFString*)path; #endif /*! * @brief Initializes the OFLocalization singleton with the specified locale. * * @warning This sets the locale via `setlocale()`! * * @warning You should never call this yourself, except if you do not use * @ref OFApplication. In this case, you need to allocate exactly one * instance of OFLocalization, which will be come the singleton, and * call this method. |
︙ |
Modified src/OFLocalization.m from [a996c854ff] to [306b376984].
︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | #import "OFArray.h" #import "OFDictionary.h" #import "OFInvalidArgumentException.h" #import "OFInvalidEncodingException.h" static OFLocalization *sharedLocalization = nil; static void parseLocale(char *locale, of_string_encoding_t *encoding, OFString **language, OFString **territory) { if ((locale = of_strdup(locale)) == NULL) return; @try { const of_string_encoding_t enc = OF_STRING_ENCODING_ASCII; char *tmp; /* We don't care for extras behind the @ */ if ((tmp = strrchr(locale, '@')) != NULL) *tmp = '\0'; /* Encoding */ if ((tmp = strrchr(locale, '.')) != NULL) { *tmp++ = '\0'; @try { if (encoding != NULL) *encoding = of_string_parse_encoding( [OFString stringWithCString: tmp encoding: enc]); } @catch (OFInvalidEncodingException *e) { } } /* Territory */ if ((tmp = strrchr(locale, '_')) != NULL) { *tmp++ = '\0'; if (territory != NULL) *territory = [OFString stringWithCString: tmp encoding: enc]; } if (language != NULL) *language = [OFString stringWithCString: locale encoding: enc]; } @finally { free(locale); } } @implementation OFLocalization @synthesize language = _language, territory = _territory, encoding = _encoding; @synthesize decimalPoint = _decimalPoint; + (instancetype)sharedLocalization { |
︙ | |||
60 61 62 63 64 65 66 | 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 | - + - - - - - - - - - - - - - - - - - - - + - - - - - - - - - - - + + + + - - - + + + - - - + + + + + + + + + - - + - + + - + - - - - + + - - - - + - - - - - | #ifdef OF_HAVE_FILES + (void)addLanguageDirectory: (OFString*)path { [sharedLocalization addLanguageDirectory: path]; } #endif |
︙ |