This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_lbYycUnpEDiffKuTu4D-uw" exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20"> | |
<bpmn2:itemDefinition id="_travellerItem" structureRef="org.acme.travel.Traveller"/> | |
<bpmn2:itemDefinition id="__0E0784C3-1BEC-4A51-A5E6-D7E5DA3A4402_eventInputXItem" structureRef="org.acme.travel.Traveller"/> | |
<bpmn2:itemDefinition id="processedtravellersType" structureRef="org.acme.travel.Traveller"/> | |
<bpmn2:itemDefinition id="__60FA6326-76DC-4DB2-AB06-DB8AC8EE8DC8_namespaceInputXItem" structureRef="java.lang.String"/> | |
<bpmn2:itemDefinition id="__60FA6326-76DC-4DB2-AB06-DB8AC8EE8DC8_modelInputXItem" str |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { DefaultKeyboardShortcutsService, KeyboardShortcutsApi } from "@kogito-tooling/microeditor-envelope"; | |
import { ChannelType, getOperatingSystem } from "@kogito-tooling/core-api"; | |
export class EmbeddedEditorKeyboardShortcuts { | |
private static instance: KeyboardShortcutsApi; | |
public static getInstance(channel: ChannelType): KeyboardShortcutsApi { | |
if (!EmbeddedEditorKeyboardShortcuts.instance) { | |
console.log("new instance") | |
const editorContext = { channel, operatingSystem: getOperatingSystem() }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface MyDictionary extends ReferenceDictionary<MyDictionary> { | |
inputName: string; | |
welcome: (name: string) => string; | |
home: { | |
title: string; | |
body: string; | |
}; | |
currentLocale: (locale: string) => string; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const english: MyDictionary = { | |
inputName: "Please, enter your name", | |
welcome: (name) => `Welcome ${name.bold()}`, | |
home: { | |
title: "This is a React i18n library!", | |
body: "Use i18n on your TypeScript projects!" | |
}, | |
currentLocale: (locale) => `My current locale is: ${locale}` | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const portuguese: TranslatedDictionary<MyDictionary> = { | |
inputName: "Por favor, coloque o seu nome", | |
home: { | |
title: "Está é uma biblioteca i18n para React", | |
body: "Use i18n em seus projetos TypeScript!" | |
}, | |
currentLocale: (locale) => `Meu local atual é: ${locale}` | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The Context typed with your Dictionary, which will be used by your components | |
export const myI18nCtx React.createContext<I18nContextType<MyDictionary>>({} as any); | |
export function App(props: Props) { | |
// Fallback locale and respective dictionary | |
const myI18nDefaults = { locale: "en", dictionary: english }; | |
// All your dictionaries. The key of the Map object should follow the browser pattern | |
const myI18nDictionaries = new Map([ | |
["en", english], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
inputName: "Por favor, coloque o seu nome", | |
welcome: (name) => `Welcome ${name.bold()}`, | |
home: { | |
title: "Está é uma biblioteca i18n para React", | |
body: "Use i18n em seus projetos TypeScript!" | |
}, | |
currentLocale: (locale) => `Meu local atual é: ${locale}` | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function MyComponent() { | |
const { locale, setLocale, i18n } = useContext(myI18nCtx); | |
const [name, setName] = useState(""); | |
return ( | |
<div> | |
<p>{i18n.home.title} :)</p> | |
<p>{i18n.home.body}</p> | |
<input type={"text"} value={name} onChange={e => setName(e.target.value)} /> | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:bpsim="http://www.bpsim.org/schemas/1.0" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:drools="http://www.jboss.org/drools" id="_1brjsNmbEDiaQbsAHnaueg" exporter="jBPM Process Modeler" exporterVersion="2.0" targetNamespace="http://www.omg.org/bpmn20"> | |
<bpmn2:itemDefinition id="__E6A34ECE-E7C7-4CF6-9F60-5E8B7613A9D0_namespaceInputXItem" structureRef="java.lang.String"/> | |
<bpmn2:itemDefinition id="__E6A34ECE-E7C7-4CF6-9F60-5E8B7613A9D0_modelInputXItem" structureRef="java.lang.String"/> | |
<bpmn2:itemDefinition id="__E6A34ECE-E7C7-4CF6-9F60-5E8B7613A9D0_decisionInputXItem" structureRef="java.lang.String"/> | |
<bpmn2:itemDefinition id="__E1E5712E-205A-4E74-972D-1A3555481D8B_SkippableInputXItem" structureRef="Object"/> | |
<bpmn2:itemDefinition id="__E1E5712E-205A-4E |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as EditorEnvelope from "@kogito-tooling/editor/dist/envelope"; | |
import { Base64PngEditorFactory } from "base64png-editor"; | |
import { ChannelType, getOperatingSystem } from "@kogito-tooling/channel-common-api"; | |
declare global { | |
export const acquireVsCodeApi: any; | |
} | |
EditorEnvelope.init({ | |
container: document.getElementById("envelope-app")!, |
OlderNewer