返回 Skill 列表
extension
分类: 开发与工程无需 API Key

Locale Extractor

从Liquid文件中提取硬编码文本并将其替换为翻译键的工具。

person作者: jakexiaohubgithub

Capabilities

Helps developers internationalize their themes by finding hardcoded strings and moving them to a locale JSON structure.

Tools Usage Guide

1. extract_locales

Scans Liquid content for hardcoded text inside HTML tags and proposes replacements.

  • Param liquid_content: The raw liquid code.
  • Param section_name: The name of the section (used for key namespacing).
  • Returns:
    • modified_liquid: The code with {{ 'key' | t }} replacements.
    • new_locales: A JSON object with the extracted keys and values.

Example

Input:

<h1>Hello World</h1>
<p>Welcome to our store</p>

Output:

{
  "modified_liquid": "<h1>{{ 'sections.header.hello_world' | t }}</h1>\n<p>{{ 'sections.header.welcome' | t }}</p>",
  "new_locales": {
    "sections": {
      "header": {
        "hello_world": "Hello World",
        "welcome": "Welcome to our store"
      }
    }
  }
}