AppleScript名:ローカライズドな度量衡変換(lengthFormatter) |
— Created 2015-11-20 by Shane Stanley use AppleScript version "2.4" use scripting additions use framework "Foundation" set theNSMassFormatter to current application’s NSMassFormatter’s alloc()’s init() theNSMassFormatter’s numberFormatter()’s setLocale:(current application’s NSLocale’s localeWithLocaleIdentifier:"en-US") theNSMassFormatter’s setUnitStyle:(current application’s NSFormattingUnitStyleLong) (theNSMassFormatter’s stringFromKilograms:85) as list of string or string log result –> "187.393 pounds" (theNSMassFormatter’s stringFromValue:1 unit:(current application’s NSMassFormatterUnitGram)) as list of string or string log result –> "1 gram" set theNSLengthFormatter to current application’s NSLengthFormatter’s alloc()’s init() theNSLengthFormatter’s numberFormatter()’s setLocale:(current application’s NSLocale’s localeWithLocaleIdentifier:"ja") theNSLengthFormatter’s setUnitStyle:(current application’s NSFormattingUnitStyleLong) (theNSLengthFormatter’s stringFromMeters:1) as list of string or string log result –> "100センチメートル"–We usually use "100cm" in Japanese. (theNSLengthFormatter’s stringFromValue:1 unit:(current application’s NSLengthFormatterUnitFoot)) as list of string or string log result –> "1フィート" |
More from my site
(Visited 33 times, 1 visits today)