function parseTranslationString(string) {
    const START = 0;
    const IN_VARIABLE = 1;
    const errors = [];

    let state = START;
    let currentVariable = '';
    let variableStartColumn = 0;
    const variables = new Map();

    // Use 1-indexed iterators since column is used a lot more than index
    for (let column = 1; column <= string.length; column++) {
        const character = string[column - 1];
        if (character === '{') {
            if (state === START) {
                state = IN_VARIABLE;
                // The brace is at the current column; the variable starts at the next column
                variableStartColumn = column + 1;
            } else {
                errors.push({message: 'Unexpected "{" in variable', column});
            }
        } else if (character === '}') {
            if (state === IN_VARIABLE) {
                state = START;
                variables.set(currentVariable, variableStartColumn);
                currentVariable = '';
            } else {
                errors.push({message: 'Unexpected "}" in string', column});
            }
        } else if (state === IN_VARIABLE) {
            currentVariable += character;
        }
    }

    if (state === IN_VARIABLE) {
        errors.push({message: 'Unclosed {', column: variableStartColumn});
    }

    return {variables, errors};
}
Extracts translations variables and any invalid interpolations from a string
@param {string} string the translation to parse