OpenCC icon

OpenCC

Get data from OpenCC API

Actions2

Overview

This node performs text conversion between different Chinese character sets using the OpenCC library. It is useful for scenarios where you need to convert text from Simplified Chinese to Traditional Chinese, Traditional Chinese to Simplified Chinese, or regional variants such as Taiwan (TW) and Mainland China (CN) forms.

Practical examples include:

  • Converting user-generated content from Simplified Chinese to Traditional Chinese for audiences in Taiwan or Hong Kong.
  • Normalizing text data for NLP applications that require consistent character sets.
  • Preparing documents or messages for localization by converting between regional Chinese variants.

Properties

Name Meaning
Text The input text string that you want to convert.
Conversion The type of conversion to apply. Options:
- Simplified to Traditional
- Traditional to Simplified
- TW to CN (Taiwan to Mainland China variant)
- CN to TW (Mainland China to Taiwan variant)

Output

The node outputs an array with one item per input. Each output item contains a json object with the following field:

  • result: The converted text string after applying the selected conversion.

If an error occurs during processing and the node is set to continue on failure, the output will contain an error field with the error message.

Dependencies

  • This node depends on the opencc-js library for performing the Chinese text conversions.
  • It also uses a local normalization module to further normalize the converted text according to the conversion type.
  • No external API keys or credentials are required.
  • No special environment variables or n8n configurations are needed beyond standard node setup.

Troubleshooting

  • Common issues:
    • Input text may be empty or not properly formatted, resulting in no meaningful output.
    • Selecting an unsupported conversion type (though the UI limits options) would cause fallback to no conversion.
  • Error messages:
    • Errors thrown during conversion will appear in the output if "Continue On Fail" is enabled.
    • Typical errors might relate to invalid input types or unexpected characters.
  • Resolution:
    • Ensure the input text is a valid string.
    • Use only the provided conversion options.
    • Enable "Continue On Fail" to handle errors gracefully in workflows.

Links and References

Discussion