指定の任意のLocaleもしくはScript実行中のユーザー環境のLocaleを取得して、曜日の短縮名称を取得するAppleScriptです。
AppleScript名:指定Localeおよび現在のユーザー環境のLocaleから短縮曜日名を取得 |
— Created 2019-02-14 by Takaaki Naganoya — 2019 Piyomaru Software use AppleScript version "2.4" use scripting additions use framework "Foundation" set aList to getLocalizedShortDaynames("en_US") –> {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"} set aList to getLocalizedShortDaynames("fr_FR") –> {"dim.", "lun.", "mar.", "mer.", "jeu.", "ven.", "sam."} set aList to getLocalizedShortDaynames("ja_JP") –> {"日", "月", "火", "水", "木", "金", "土"} set aList to getLocalizedShortDaynames("zh-Hans") –> {"周日", "周一", "周二", "周三", "周四", "周五", "周六"} –現在のユーザーのLocale情報を取得して短縮曜日名を取得 set curLoc to (current application’s NSLocale’s currentLocale’s objectForKey:(current application’s NSLocaleIdentifier)) as string –> "ja_JP" set bList to getLocalizedShortDaynames(curLoc) of me –> {"日", "月", "火", "水", "木", "金", "土"} –ローカライズされた曜日名称を返す(短縮名称) on getLocalizedShortDaynames(aLoc) set df to current application’s NSDateFormatter’s alloc()’s init() df’s setLocale:(current application’s NSLocale’s localeWithLocaleIdentifier:aLoc) set dayNames to df’s shortStandaloneWeekdaySymbols() as list return dayNames end getLocalizedShortDaynames |
More from my site
(Visited 36 times, 1 visits today)