配列変数に入れた言語コードを、デフォルトのLocaleの言語による表現で、言語名称を求めるAppleScriptです。
AppleScript名:指定の言語コードを、デフォルトのLocaleの表現で、言語名称に.scpt |
— – Created by: Takaaki Naganoya – Created on: 2020/08/14 — – Copyright © 2020 Piyomaru Software, All Rights Reserved — use AppleScript version "2.4" use scripting additions use framework "Foundation" set langList to {"en", "ru", "ja"} set aList to getLocalizedLangNameList(langList) of me –> {"英語", "ロシア語", "日本語"} on getLocalizedLangNameList(langList) set aLocale to (current application’s NSLocale’s currentLocale()) set langLocalizedList to {} repeat with i in langList set aLang to getLangNameWithLocale(i, aLocale) of me set the end of langLocalizedList to aLang end repeat return langLocalizedList end getLocalizedLangNameList on getLangNameWithLocale(langCode, aLocale) set aLangName to (aLocale’s displayNameForKey:(current application’s NSLocaleIdentifier) value:langCode) as string return aLangName end getLangNameWithLocale |
More from my site
(Visited 63 times, 1 visits today)