diff --git a/public/client.js b/public/client.js index 6379e90..61d4609 100644 --- a/public/client.js +++ b/public/client.js @@ -9,102 +9,102 @@ COBI.devkit.overrideThumbControllerMapping.write(true); var inEditMode = (COBI.parameters.context() == COBI.context.offRideSettings || COBI.parameters.context() == COBI.context.onRideSettings); // Allow user to zoom in and out -COBI.hub.externalInterfaceAction.subscribe(function(action) { - // Listen to inputs and update zoom index variable - if ((action == 'UP' || action == 'RIGHT')) { - zoomIn(); - } - if ((action == 'DOWN' || action == 'LEFT')) { - zoomOut(); - } +COBI.hub.externalInterfaceAction.subscribe(function (action) { + // Listen to inputs and update zoom index variable + if ((action == 'UP' || action == 'RIGHT')) { + zoomIn(); + } + if ((action == 'DOWN' || action == 'LEFT')) { + zoomOut(); + } }); // Display detailled item names if touch interaction is allowed -COBI.app.touchInteractionEnabled.subscribe(function(touchInteractionEnabled) { - updateInterfaceVisibility(touchInteractionEnabled); +COBI.app.touchInteractionEnabled.subscribe(function (touchInteractionEnabled) { + updateInterfaceVisibility(touchInteractionEnabled); }); // Define id, name, events, formatting functions, units and default value for each item var definitions = [ - { - id: 'speed', - name: 'Speed', - subscribe: COBI.rideService.speed.subscribe, - unsubscribe: COBI.rideService.speed.unsubscribe, - formatter: formatSpeedDot1, - unit: 'km/h', - defaultValue: '-' - }, - { - id: 'average_speed', - name: 'Avg Speed', - subscribe: COBI.tourService.averageSpeed.subscribe, - unsubscribe: COBI.tourService.averageSpeed.unsubscribe, - formatter: formatSpeedDot1, - unit: 'Ø km/h', - defaultValue: '-' - }, - { - id: 'user_power', - name: 'User Power', - subscribe: COBI.rideService.userPower.subscribe, - unsubscribe: COBI.rideService.userPower.unsubscribe, - formatter: formatInt, - unit: 'watts', - defaultValue: '-' - }, - { - id: 'cadence', - name: 'Cadence', - subscribe: COBI.rideService.cadence.subscribe, - unsubscribe: COBI.rideService.cadence.unsubscribe, - formatter: formatInt, - unit: 'rpm', - defaultValue: '-' - }, - { - id: 'distance', - name: 'Distance', - subscribe: COBI.tourService.ridingDistance.subscribe, - unsubscribe: COBI.tourService.ridingDistance.unsubscribe, - formatter: formatDistanceDot1, - unit: 'km total', - defaultValue: '-' - }, - { - id: 'calories', - name: 'Calories', - subscribe: COBI.tourService.calories.subscribe, - unsubscribe: COBI.tourService.calories.unsubscribe, - formatter: formatInt, - unit: 'kcal', - defaultValue: '-' - }, - { - id: 'ascent', - name: 'Ascent', - subscribe: COBI.tourService.ascent.subscribe, - unsubscribe: COBI.tourService.ascent.unsubscribe, - formatter: formatInt, - unit: 'm', - defaultValue: '-' - }, - { - id: 'heart_rate', - name: 'Heart Rate', - subscribe: COBI.rideService.heartRate.subscribe, - unsubscribe: COBI.rideService.heartRate.unsubscribe, - formatter: formatInt, - unit: 'bpm', - defaultValue: '-' - }, - { - id: 'duration', - name: 'Duration', - subscribe: COBI.tourService.ridingDuration.subscribe, - unsubscribe: COBI.tourService.ridingDuration.unsubscribe, - formatter: formatMins, - unit: 'min', - defaultValue: '-' - } + { + id: 'speed', + name: i18next.t('speed'), + subscribe: COBI.rideService.speed.subscribe, + unsubscribe: COBI.rideService.speed.unsubscribe, + formatter: formatSpeedDot1, + unit: 'km/h', + defaultValue: '-' + }, + { + id: 'average_speed', + name: i18next.t('average_speed'), + subscribe: COBI.tourService.averageSpeed.subscribe, + unsubscribe: COBI.tourService.averageSpeed.unsubscribe, + formatter: formatSpeedDot1, + unit: 'Ø km/h', + defaultValue: '-' + }, + { + id: 'user_power', + name: i18next.t('user_power'), + subscribe: COBI.rideService.userPower.subscribe, + unsubscribe: COBI.rideService.userPower.unsubscribe, + formatter: formatInt, + unit: 'watts', + defaultValue: '-' + }, + { + id: 'cadence', + name: i18next.t('cadence'), + subscribe: COBI.rideService.cadence.subscribe, + unsubscribe: COBI.rideService.cadence.unsubscribe, + formatter: formatInt, + unit: 'rpm', + defaultValue: '-' + }, + { + id: 'distance', + name: i18next.t('distance'), + subscribe: COBI.tourService.ridingDistance.subscribe, + unsubscribe: COBI.tourService.ridingDistance.unsubscribe, + formatter: formatDistanceDot1, + unit: 'km total', + defaultValue: '-' + }, + { + id: 'calories', + name: i18next.t('calories'), + subscribe: COBI.tourService.calories.subscribe, + unsubscribe: COBI.tourService.calories.unsubscribe, + formatter: formatInt, + unit: 'kcal', + defaultValue: '-' + }, + { + id: 'ascent', + name: i18next.t('ascent'), + subscribe: COBI.tourService.ascent.subscribe, + unsubscribe: COBI.tourService.ascent.unsubscribe, + formatter: formatInt, + unit: 'm', + defaultValue: '-' + }, + { + id: 'heart_rate', + name: i18next.t('heart_rate'), + subscribe: COBI.rideService.heartRate.subscribe, + unsubscribe: COBI.rideService.heartRate.unsubscribe, + formatter: formatInt, + unit: 'bpm', + defaultValue: '-' + }, + { + id: 'duration', + name: i18next.t('duration'), + subscribe: COBI.tourService.ridingDuration.subscribe, + unsubscribe: COBI.tourService.ridingDuration.unsubscribe, + formatter: formatMins, + unit: 'min', + defaultValue: '-' + } ]; diff --git a/public/localization.js b/public/localization.js new file mode 100644 index 0000000..f27d7fd --- /dev/null +++ b/public/localization.js @@ -0,0 +1,52 @@ +// Initialize localization with language set by cobi parameter +i18next.init( + { + lng: COBI.parameters.language(), + fallbackLng: ['en', 'de', 'fr'], + whitelist: ['en', 'de', 'fr'], + resources: { + en: { + translation: { + 'speed': 'Speed', + 'average_speed': 'Avg Speed', + 'user_power': 'User Power', + 'cadence': 'Cadence', + 'distance': 'Distance', + 'calories': 'Calories', + 'ascent': 'Ascent', + 'heart_rate': 'Heart Rate', + 'duration': 'Duration' + } + }, + de: { + translation: { + 'speed': 'Geschwindigkeit', + 'average_speed': 'durchschnittliche Geschwindigkeit', + 'user_power': 'Benutzerleistung', + 'cadence': 'Kadenz', + 'distance': 'Entfernung', + 'calories': 'Kalorien', + 'ascent': 'Aufstieg', + 'heart_rate': 'Puls', + 'duration': 'Dauer' + } + }, + fr: { + translation: { + 'speed': 'Vitesse', + 'average_speed': 'Vitesse moyenne', + 'user_power': 'Energie utilisée', + 'cadence': 'Fréquence de pédalage', + 'distance': 'Distance', + 'calories': 'Calories', + 'ascent': 'Dénilevé', + 'heart_rate': 'Rythme cardiaque', + 'duration': 'Durée de la session' + + } + } + } + }, + function (err, t) { + } +); diff --git a/public/style.css b/public/style.css index 683af94..2b8d649 100644 --- a/public/style.css +++ b/public/style.css @@ -16,7 +16,7 @@ ul { .uk-card-default { background: #2d2d37; color: #FFF; - box-shadow: 0; + box-shadow: none; padding: .7rem .5rem; } @@ -31,6 +31,7 @@ ul { letter-spacing: .05rem; text-transform: uppercase; margin-bottom: 1.2rem; + max-height: 15px; } .value { diff --git a/views/index.html b/views/index.html index 5c7b9c1..3697788 100644 --- a/views/index.html +++ b/views/index.html @@ -1,107 +1,109 @@ - - COBI Grid - - + + COBI Grid + + - - - - - - - - - + + + + + + + + +