4Jawaly Actions

4Jawaly utility actions and helpers

Detect Language

AI-generated

Overview

This node performs various utility actions including detecting the language of a given text, specifically distinguishing between Arabic and English. It is useful for workflows that need to automatically identify the language of input text for further processing or routing. For example, it can analyze user input to determine if it is in Arabic or English and return the language name or code in different formats.

Use Case Examples

  1. Detect language of a customer support message to route it to the appropriate language team.
  2. Analyze text content to apply language-specific processing or translation workflows.

Properties

Name Meaning
Text to Analyze The text input that the node will analyze to detect its language.
Return Format The format in which the detected language result is returned, either Arabic names, English names, or language codes.

Output

JSON

  • success - Indicates if the operation was successful.
  • operation - The operation performed, here it is 'detectLanguage'.
  • language - The detected language name or code based on the selected return format.
  • language_code - The language code detected ('ar' or 'en').
  • language_name_arabic - The language name in Arabic script ('عربي' or 'انجليزي').
  • language_name_english - The language name in English ('Arabic' or 'English').
  • detected_as - The detected language category ('arabic' or 'english').
  • text_length - The length of the analyzed text.
  • arabic_chars_count - The count of Arabic characters found in the text.
  • arabic_percentage - The percentage of Arabic characters relative to the total text length.
  • analyzed_text - A preview snippet of the analyzed text (up to 100 characters).

Dependencies

  • n8n-workflow
  • crypto
  • axios
  • fs
  • path

Troubleshooting

  • Ensure the 'Text to Analyze' input is not empty or only whitespace, as this will cause an error.
  • If the text contains JSON, it attempts to parse and stringify it; malformed JSON may cause unexpected results.
  • The detection is based on presence of Arabic Unicode ranges; mixed or other languages may not be accurately detected.

Discussion