Skip to content

Instantly share code, notes, and snippets.

@Kazuki-tam
Created October 24, 2024 06:48
Show Gist options
  • Select an option

  • Save Kazuki-tam/8575c0b34008e92b619481b3117a7e8b to your computer and use it in GitHub Desktop.

Select an option

Save Kazuki-tam/8575c0b34008e92b619481b3117a7e8b to your computer and use it in GitHub Desktop.
customMenu
var global=this;
function onOpen() {
}
(() => {
// src/sheet/createCustomMenu.ts
function createCustomMenu() {
const ui = SpreadsheetApp.getUi();
const userLocale = Session.getActiveUserLocale();
const menuTitle = "Figma2Sheet";
let menuItemTitle1 = "Insert Figma Image";
let menuItemTitle2 = "Insert Figma HTML";
if (userLocale === "ja") {
menuItemTitle1 = "Figma\u304B\u3089\u753B\u50CF\u3092\u633F\u5165";
menuItemTitle2 = "Figma\u304B\u3089HTML\u3092\u633F\u5165";
}
ui.createMenu(menuTitle).addItem(menuItemTitle1, "insertFigmaImage").addItem(menuItemTitle2, "insertFigma2HTML").addToUi();
}
// src/customMenu.ts
var onOpen = function() {
createCustomMenu();
};
global.onOpen = onOpen;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment