add localization
This commit is contained in:
7
src/lang/en.json
Normal file
7
src/lang/en.json
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"SESSION_TITLE_SUGGESTIONS.SUGGESTION_AUTOCOMPLETE_MESSAGE": "Enter your session title suggestion.",
|
||||||
|
"SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_COMMAND_DESCRIPTION": "List all title suggestions for the most recent session",
|
||||||
|
"SESSION_TITLE_SUGGESTIONS.SUGGESTION_COMMAND_DESCRIPTION": "Suggest a title for this session",
|
||||||
|
"SESSION_TITLE_SUGGESTIONS.SUGGESTION_FLAVOR": "suggesting a session title",
|
||||||
|
"SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_FLAVOR": "session title suggestions"
|
||||||
|
}
|
||||||
@@ -12,6 +12,13 @@
|
|||||||
"minimum": "10",
|
"minimum": "10",
|
||||||
"verified": "11"
|
"verified": "11"
|
||||||
},
|
},
|
||||||
|
"languages": [
|
||||||
|
{
|
||||||
|
"lang": "en",
|
||||||
|
"name": "English",
|
||||||
|
"path": "lang/en.json"
|
||||||
|
}
|
||||||
|
],
|
||||||
"download": "https://gitea.ascorrea.com/asc/asc-session-title-suggestions/releases/download/0.1.2/asc-session-title-suggestions-0.1.2.zip",
|
"download": "https://gitea.ascorrea.com/asc/asc-session-title-suggestions/releases/download/0.1.2/asc-session-title-suggestions-0.1.2.zip",
|
||||||
"manifest":"https://gitea.ascorrea.com/asc/asc-session-title-suggestions/raw/branch/master/src/module.json",
|
"manifest":"https://gitea.ascorrea.com/asc/asc-session-title-suggestions/raw/branch/master/src/module.json",
|
||||||
"scripts": [
|
"scripts": [
|
||||||
|
|||||||
@@ -24,12 +24,11 @@ function registerClipboardCopyButton() {
|
|||||||
|
|
||||||
|
|
||||||
function registerCustomChatCommands() {
|
function registerCustomChatCommands() {
|
||||||
game.chatCommands.unregister(NAME)
|
|
||||||
game.chatCommands.register({
|
game.chatCommands.register({
|
||||||
name: NAME,
|
name: NAME,
|
||||||
module: "_chatcommands",
|
module: "_chatcommands",
|
||||||
aliases: ["/t", "t/"],
|
aliases: ["/t", "t/"],
|
||||||
description: "Suggest a title for this episode",
|
description: game.i18n.localize("SESSION_TITLE_SUGGESTIONS.SUGGESTION_COMMAND_DESCRIPTION"),
|
||||||
icon: '<i class="fa-solid fa-podcast"></i>',
|
icon: '<i class="fa-solid fa-podcast"></i>',
|
||||||
requiredRole: "NONE",
|
requiredRole: "NONE",
|
||||||
callback: async (chat, parameters, messageData) => {
|
callback: async (chat, parameters, messageData) => {
|
||||||
@@ -40,16 +39,17 @@ function registerCustomChatCommands() {
|
|||||||
newMessageData.flags = {session_title_suggestion: titleSuggestion}
|
newMessageData.flags = {session_title_suggestion: titleSuggestion}
|
||||||
return newMessageData;
|
return newMessageData;
|
||||||
},
|
},
|
||||||
autocompleteCallback: (menu, alias, parameters) => [game.chatCommands.createInfoElement("Enter a message.")],
|
autocompleteCallback: (menu, alias, parameters) => [
|
||||||
|
game.chatCommands.createInfoElement(game.i18n.localize("SESSION_TITLE_SUGGESTIONS.SUGGESTION_AUTOCOMPLETE_MESSAGE"))
|
||||||
|
],
|
||||||
closeOnComplete: true
|
closeOnComplete: true
|
||||||
});
|
}, true);
|
||||||
|
|
||||||
game.chatCommands.unregister(NAME+"s")
|
|
||||||
game.chatCommands.register({
|
game.chatCommands.register({
|
||||||
name: NAME+"s",
|
name: NAME+"s",
|
||||||
module: "_chatcommands",
|
module: "_chatcommands",
|
||||||
aliases: ["/ts"],
|
aliases: ["/ts"],
|
||||||
description: "List all titles for the most recent episode",
|
description: game.i18n.localize("SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_COMMAND_DESCRIPTION"),
|
||||||
icon: '<i class="fa-solid fa-podcast"></i>',
|
icon: '<i class="fa-solid fa-podcast"></i>',
|
||||||
requiredRole: "TRUSTED",
|
requiredRole: "TRUSTED",
|
||||||
callback: async (chat, parameters, messageData) => {
|
callback: async (chat, parameters, messageData) => {
|
||||||
@@ -67,16 +67,13 @@ function registerCustomChatCommands() {
|
|||||||
newMessageData.flavor = await renderTemplate(TEMPLATES.suggestionList.flavor, {date:last_message_date.toDateString()})
|
newMessageData.flavor = await renderTemplate(TEMPLATES.suggestionList.flavor, {date:last_message_date.toDateString()})
|
||||||
return newMessageData;
|
return newMessageData;
|
||||||
},
|
},
|
||||||
autocompleteCallback: (menu, alias, parameters) => [game.chatCommands.createInfoElement("Enter a message.")],
|
autocompleteCallback: (menu, alias, parameters) => [],
|
||||||
closeOnComplete: true
|
closeOnComplete: true
|
||||||
});
|
}, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("Hello World! This code runs immediately when the file is loaded.");
|
|
||||||
|
|
||||||
Hooks.on("init", function() {
|
Hooks.on("init", function() {
|
||||||
//This code runs once the Foundry VTT software begins its initialization workflow
|
//This code runs once the Foundry VTT software begins its initialization workflow
|
||||||
registerCustomChatCommands();
|
|
||||||
registerClipboardCopyButton();
|
registerClipboardCopyButton();
|
||||||
loadTemplates(flavor_template_path)
|
loadTemplates(flavor_template_path)
|
||||||
Object.values(TEMPLATES.suggestion).forEach((template_path)=>{
|
Object.values(TEMPLATES.suggestion).forEach((template_path)=>{
|
||||||
@@ -87,8 +84,10 @@ Hooks.on("init", function() {
|
|||||||
loadTemplates(template_path)
|
loadTemplates(template_path)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
Hooks.on("ready", function() {
|
Hooks.on("ready", function() {
|
||||||
//This code runs once core initialization is ready and game data is available.
|
//This code runs once core initialization is ready and game data is available.
|
||||||
|
registerCustomChatCommands();
|
||||||
});
|
});
|
||||||
@@ -1 +1 @@
|
|||||||
<i class="fa-solid fa-podcast"></i> suggesting an session title...
|
<i class="fa-solid fa-podcast"></i> {{localize 'SESSION_TITLE_SUGGESTIONS.SUGGESTION_FLAVOR'}}...
|
||||||
@@ -1 +1 @@
|
|||||||
<i class="fa-solid fa-podcast"></i> title suggestions ({{date}}):
|
<i class="fa-solid fa-podcast"></i> {{localize "SESSION_TITLE_SUGGESTIONS.SUGGESTION_LIST_FLAVOR"}} ({{date}}):
|
||||||
Reference in New Issue
Block a user