- 영어(en)
- 중국어(간체)(zh)
- 중국어(번체)(zh-TW)
- 프랑스어(fr)
- 한국어(ko)
- 러시아어(ru)
- 스페인어(es)
- 일본어(ja)
- 아랍어(ar)
디렉토리 구조
커스텀 노드 아래에locales 폴더를 생성하고, 여러 유형의 번역 파일을 지원하세요:
your_custom_node/
├── __init__.py
├── your_node.py
└── locales/ # i18n 지원 폴더
├── en/ # 영어 번역 (기본으로 권장)
│ ├── main.json # 일반적인 영어 번역 내용
│ ├── nodeDefs.json # 영어 노드 정의 번역
│ ├── settings.json # 선택사항: 설정 인터페이스 번역
│ └── commands.json # 선택사항: 명령어 번역
├── zh/ # 중국어 번역 파일
│ ├── nodeDefs.json # 중국어 노드 정의 번역
│ ├── main.json # 일반적인 중국어 번역 내용
│ ├── settings.json # 중국어 설정 인터페이스 번역
│ └── commands.json # 중국어 명령어 번역
├──...
nodeDefs.json - 노드 정의 번역
예를 들어, i18n-demo 노드의 파이썬 정의 예시는 다음과 같습니다:class I18nTextProcessor:
@classmethod
def INPUT_TYPES(cls):
return {
"required": {
"text": ("STRING", {
"multiline": True,
"default": "Hello World!",
"tooltip": "처리할 원본 텍스트 내용"
}),
"operation": (["uppercase", "lowercase", "reverse", "add_prefix"], {
"default": "uppercase",
"tooltip": "실행할 텍스트 처리 작업"
}),
"count": ("INT", {
"default": 1,
"min": 1,
"max": 10,
"step": 1,
"tooltip": "작업을 반복할 횟수"
}),
},
"optional": {
"prefix": ("STRING", {
"default": "[I18N] ",
"multiline": False,
"tooltip": "텍스트 앞에 추가할 접두사"
}),
}
}
RETURN_TYPES = ("STRING",)
RETURN_NAMES = ("processed_text",)
FUNCTION = "process_text"
CATEGORY = "I18n Demo"
DESCRIPTION = "다국어 지원을 갖춘 간단한 i18n 데모 노드로, 텍스트 처리를 시연합니다"
def process_text(self, text, operation, count, prefix=""):
try:
result = text
for _ in range(count):
if operation == "uppercase":
result = result.upper()
elif operation == "lowercase":
result = result.lower()
elif operation == "reverse":
result = result[::-1]
elif operation == "add_prefix":
result = prefix + result
return (result,)
except Exception as e:
print(f"I18nTextProcessor 오류: {e}")
return (f"오류: {str(e)}",)
{
"I18nTextProcessor": {
"display_name": "I18n 텍스트 프로세서",
"description": "다국어 지원을 갖춘 간단한 i18n 데모 노드로, 텍스트 처리를 시연합니다",
"inputs": {
"text": {
"name": "텍스트 입력",
"tooltip": "처리할 원본 텍스트 내용"
},
"operation": {
"name": "작업 유형",
"tooltip": "실행할 텍스트 처리 작업",
"options": {
"uppercase": "대문자로",
"lowercase": "소문자로",
"reverse": "텍스트 역순",
"add_prefix": "접두사 추가"
}
},
"count": {
"name": "반복 횟수",
"tooltip": "작업을 반복할 횟수"
},
"prefix": {
"name": "접두사 텍스트",
"tooltip": "텍스트 앞에 추가할 접두사"
}
},
"outputs": {
"0": {
"name": "처리된 텍스트",
"tooltip": "최종 처리된 텍스트 결과"
}
}
}
}
0, 두 번째 출력은 1 등으로 표기됩니다.
메뉴 설정
예를 들어, i18n-demo 커스텀 노드에서는 다음과 같은 두 가지 메뉴 설정을 등록했습니다:app.registerExtension({
name: "I18nDemo",
settings: [
{
id: "I18nDemo.EnableDebugMode",
category: ["I18nDemo","DebugMode"], // main.json의 settingsCategories 키와 일치함
name: "디버그 모드 활성화", // 번역에 의해 덮어쓰임
tooltip: "i18n 데모 노드의 디버그 정보를 콘솔에 표시", // 번역에 의해 덮어쓰임
type: "boolean",
defaultValue: false,
experimental: true,
onChange: (value) => {
console.log("I18n Demo:", value ? "디버그 모드 활성화" : "디버그 모드 비활성화");
}
},
{
id: "I18nDemo.DefaultTextOperation",
category: ["I18nDemo","DefaultTextOperation"], // main.json의 settingsCategories 키와 일치함
name: "기본 텍스트 작업", // 번역에 의해 덮어쓰임
tooltip: "텍스트 프로세서 노드의 기본 작업", // 번역에 의해 덮어쓰임
type: "combo",
options: ["uppercase", "lowercase", "reverse", "add_prefix"],
defaultValue: "uppercase",
experimental: true
}
],
})
main.json 파일에 추가해야 합니다:
{
"settingsCategories": {
"I18nDemo": "I18n 데모",
"DebugMode": "디버그 모드",
"DefaultTextOperation": "기본 텍스트 작업"
}
}
settings.json 파일에서 별도로 업데이트하는 것이 좋습니다. 예를 들어:
{
"I18nDemo_EnableDebugMode": {
"name": "디버그 모드 활성화",
"tooltip": "i18n 데모 노드의 디버그 정보를 콘솔에 표시"
},
"I18nDemo_DefaultTextOperation": {
"name": "기본 텍스트 작업",
"tooltip": "텍스트 프로세서 노드의 기본 작업",
"options": {
"uppercase": "대문자로",
"lowercase": "소문자로",
"reverse": "텍스트 역순",
"add_prefix": "접두사 추가"
}
}
}
.을 _로 바꾸어야 합니다. 예를 들어:
"I18nDemo.EnableDebugMode" -> "I18nDemo_EnableDebugMode"