Skip to content

Instantly share code, notes, and snippets.

@rok-git
Last active April 3, 2019 06:46
Show Gist options
  • Save rok-git/4a817bd043352c68db8386a0e48edd53 to your computer and use it in GitHub Desktop.
Save rok-git/4a817bd043352c68db8386a0e48edd53 to your computer and use it in GitHub Desktop.
(macOS) make a list of Japanese GENGO/日本の元号のリスト作る。
// 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