Skip to content

Message internationalisation

hecking edited this page Aug 6, 2014 · 15 revisions

Concept

Currently three basic types of messages are supported, namely suggestion, explanation/reflection and special messages. The basic messages can contain different message components that must be specified in the codebook. Message components can be of type activity, object, target, goal and value.

  • Activities describe actions like "add", "update", "go back to", etc.
  • Objects describe the object related to an activity, for example, "a hypothesis".
  • Targets refer to the entity where the activity should be performed on, for example, "to your concept map" or "to this space".
  • Goals can be used to further justify the suggestion, for example, "in order to get a better overview".
  • Values are specific entities that remain unchanged during the message translation process. Values cannot be represented in the codebook because everything can be a value. It is up to the message generating instance to make sure that words and number formats are localised. For words as values the message generating instance can:
    • use internationalised taxonomies.
    • use internationalised onthologies.
    • use app configurations.

Base messages and message components are described in propertiy files that can be used by jquery-i18n-properties.

See the test application for examples.

Suggestions

  • A suggestion must contain an activity and a specific object which is evolved in the activity.
  • A suggestion can contain additionally a target, a goal and a value.

Example:

{
    type : "prompt",
    importance : "8",
    target : {
        type : "app",  
        id : "provider_id-actor_id-generator_id"
    },
    content : {
        messageId : "sug:sug1"  // message with id sug:sug1 is of type suggestion.
        messageParams : {
            "activities": ["act:add"], // id of activity component "add"
            "objects": ["obj:concept2"], // id of object component "a concept"
            "targets": ["tar:tyc"], // id of target components "to the concept map"
            "goals": [], // none but could be the id of a goal component.
            "values": ["Energy"] // a specific value
        }
    }
}

Generated message for language=en: You could add a concept Energy to your concept map.

Explanation/Reflection

  • An explanation must contain an object to which the message refers.

Example

{
    type : "prompt",
    importance : "8",
    target : {
        type : "app",  
        id : "provider_id-actor_id-generator_id"
    },
    content : {
        messageId : "exp:exp4"  // message with id exp:expl4 is of type explanation.
        messageParams : {
            "objects": ["obj:orient"], // id of object component "orientation"
        }
    }
}

Generated message for language=en Your time spend on orientation is too long in comparison with your classmates.

Special messages:

Special messages do not have a predefined structure. They can be used for application specific messages. It is up to the message creating instance that the necessary message parameters are provided. They will be inserted into the special message in the order activities, objects, targets, goals, values.

Example

{
    type : "prompt",
    importance : "8",
    target : {
        type : "app",  
        id : "provider_id-actor_id-generator_id"
    },
    content : {
        messageId : "exp:exp4"  // message with id exp:expl4 is of type explanation.
        messageParams : {
            "values": ["Energy","Mass"], // id of object component "orientation"
        }
    }
}

Generated message for language=en You have related the concepts Energy and Mass differently in your hypothesis and your concept map.

Using the message translator

Whenever an app receives a notification object like the one above, the following code translates the message into the desired language. Fallback language is English.

var mt = new MessageTranslator();

\* notification: The notification object.
* lang: The language code of the desired language (ISO 639-1 Code).
* callback: Function called with the constructed message as parameter.
* errFunc: Function called on error.
*/
mt.constructMessage(notification, lang, callback, errFunc);