Pushing content - "files" property

This feature will be part of the December 2024 release

The files node processes files by extracting content to segments and saving those into a Flex container. For instance, you can upload a multi-column Excel file where the first column contains string keys, the second column holds the source text, and the subsequent columns include translations. By using a matching parser configuration, this setup enables you to seamlessly add or update strings within the Flex container.

The files node includes the following properties:

"files": [ { "token": .... } ]

Properties

token

The reference to the file to be parsed into segments. Use media/upload to upload the file and obtain a token.

string, Mandatory

formatId

The document format configuration to use. The configuration defines how to extract text from the original file. To enumerate all configurations, see: Document formats

int, Mandatory

trgs

Optional list of target locales. Applicable with multilingual formats such as Excel or CSV only. Use if you do not want to extract all the languages but only selected ones.

string[], Optional

trgIncluded

Some formats such as POT may contain a target language without indication what the language is. Set this property for these formats.

string, Optional

stringKeyPattern

Define how the string keys are formatted. The pattern must contain 1 or more placeholders:

  • {key} : Replace with the string key extracted from the file (enabled with formats such as XML, JSON, CSV, EXCEL and others). In Wordbee we often refer to this property as “Label”.

  • {seq} : Assign a sequential number to each extracted segment starting with 1.

  • {guid} : Assign a unique random alphanumeric identifier.

Example patterns:

  • “page-{key}”

  • “segment-{seg}-translate”

  • “{guid}-{key}”

See topic further below about recommendations.

string, Mandatory

format

Optionally specify if content should be imported as plain text or html. See the “header” property for more details. By default, the value is “plain” and any markup is removed.

string Optional

markupRemove

Optional, default is false. To explicitly remove any markup information. When setting “format” to “plain”, markup is always removed.

bool, Optional

st

Optional, default is 0. Updates status of ALL segment translations.

Generally, the Flex workflow settings can achieve the same: Setting status of changed or added translations to red status.

Permitted values: 0 = reset to neutral (gray), 1 = reset to green (OK), 2 = reset to red (PROBLEM)

int, Optional

component

Optionally, assign all strings of the file this component.

string. Optional

maintainSequence

Optional, default is false. Indicate if segments should be sorted into a contiguous sequence in the container. Read explanations further down on this page.

bool, Optional

parent

Optional, default is null. The string (key) in the container after which to position the very first segment from the uploaded file:

  • null : Segments are appended at the end of the flex container.

  • "": Empty string. Segments inserted at the top of the flex container. 

  • (a key): Segments added right after the segment with this key.

string, Optional

scfs

Segment level custom fields. If fields are extracted from the file itself (e.g. from an Excel or XML) then those get priority over the values listed here.

See detailed description listed under the “segments” node in documents/{id}/contents/push

object[], Optional

tcsf

Text level custom fields to be assigned to the translations. If fields are extracted from the file itself (e.g. from an Excel or XML) then those get priority over the values listed here.

See detailed description listed under the “segments” node in documents/{id}/contents/push

object[], Optional

Advanced Topics

Choice of string keys - stringKeyPattern

Rule of thumb: Always import files that contain both the strings and their unique keys.

Generally, it is recommended to import strings from files that contain both the strings and a unique key. In Wordbee you can import both strings and keys from Multilingual Excel and CSV, JSON and XML, POT and some other formats,

If the keys are unique within just the uploaded file but not unique globally, you would configure the stringKeyPattern accordingly. For example “loginpage-{key}” would prefix all the keys from the file to produce a globally unique key.

If you import files that do not contain keys, you can ask the system to generate sequential or unique keys, see the stringKeyPattern property. Note, that every time you import the same file, new keys are created and existing strings will not be updated and rather duplicated. This likely defeats the purpose of using a strings database.

Maintaining string sequence - maintainSequence

The maintainSequence property should only be used when importing a new set of strings. Do not enable it when uploading updates to strings. The property if enabled, moves added or updated strings in the precise order they appear in the file. It can be combined with the parent property, see description in table above.

If you do not care about the sequence then always set this property to false. This operation consumes more compute resources and is thus slower.

 

 

Copyright Wordbee - Buzzin' Outside the Box since 2008