Blank values sending data to the API

When I use the API to send an array of strings to translate, some of the values are blank (i.e. contain no value). This appears to throw a translation error. However using the Portal blank values are accepted. How can I translate an input with empty values (i.e., "one", "two", "", "three")

emoji
Parents
  • Hello Chris,

     

    You are indeed receiving that error message via the API because one of the elements in the array is empty. The reason it works in the UI is because it uses a different type of submission/input format, it treats the text you put in the UI as a full string, not an array of elements.

    Can you please provide more details on your use case and requirements either via this post or I can reach out by email with some proposed timings and we can have a quick sync.

     

    Look forward to your feedback.

     

    Thank you,

    Madalina

    emoji
  • Sending a character placeholder and dictionary to accommodate the LanguageWeaver API's inability to handle blank or empty input values was an attempt to find a work around. I may have found a better solution by sending escaped quotes (i.e., "\"\"") when a blank field is present on the outgoing translation request. Although not perfect, it does seem to be a little cleaner than trying to parse a unique character string. More testing needs to be done to verify this proposed plan unless you can offer a better way to handle blank values.

    emoji
Reply
  • Sending a character placeholder and dictionary to accommodate the LanguageWeaver API's inability to handle blank or empty input values was an attempt to find a work around. I may have found a better solution by sending escaped quotes (i.e., "\"\"") when a blank field is present on the outgoing translation request. Although not perfect, it does seem to be a little cleaner than trying to parse a unique character string. More testing needs to be done to verify this proposed plan unless you can offer a better way to handle blank values.

    emoji
Children
  • Hello Chris, 

    Apologies for the late response. Sending escaped characters may work fine for majority of language pairs but for some language pairs the quotes may be specific to that type of language (e.g. you will get back these types of quotes « » when you translate the escaped quotes from English to French).

    One option you could explore is to set up a unique value (e.g. "BLANK_TRANSLATION_VALUE" or a different string that is unlikely to occur in translation) as a Brand entry. The advantage of the brand is that any brand entry you configure will remain untranslated across all the target languages you translate into, there is no query parameter to add to your api calls as this is a global setting.

    To set-up a Brand, as an Admin, you need to go "Settings > Brands > Create Brand > input the brand you'd like to set-up in the "Brand" field then click on  Create Brand (the "Comment" field is optional and "Is Seach Pattern" should be ticked only if you set-up a regex-based brand - not applicable for this particular situation).

    Look forward to your feedback if this is likely to give you an acceptable solution for your workflow.

     

    Thank you,

    Madalina

    emoji