Last active
April 3, 2019 06:46
-
-
Save rok-git/4a817bd043352c68db8386a0e48edd53 to your computer and use it in GitHub Desktop.
(macOS) make a list of Japanese GENGO/日本の元号のリスト作る。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Compile: | |
// cc -framework Foundation listEraSymbols.m -o listEraSymbols | |
// Usage: listEraSymbols [locale] | |
// Examples: | |
// listEraSymbols -- Gengo List in default Language (C locale) | |
// listEraSymbols ja_JP -- Gengo List in Japanese | |
// listEraSymbols zh_CN -- Gengo List in Chinese | |
// listEraSymbols en_US -- Gengo List in English | |
#import <Foundation/Foundation.h> | |
int main(int argc, char *argv[]) | |
{ | |
NSString *loc = @"C"; | |
NSCalendar *jcal = [NSCalendar calendarWithIdentifier: NSCalendarIdentifierJapanese]; | |
if (argc > 1) | |
loc = [NSString stringWithUTF8String: argv[1]]; | |
jcal.locale = [NSLocale localeWithLocaleIdentifier: loc]; | |
for(NSString * era in jcal.longEraSymbols){ | |
NSLog(@"%@", era); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment