Guest User

Untitled

a guest
Mar 22nd, 2025
24
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. import Toybox.Complications;
  2. import Toybox.Lang;
  3. import Toybox.System;
  4.  
  5. // add ComplicationSubscriber permission to manifest
  6.  
  7. function getComplicationLongLabel(type as Complications.Type, defaultText as String) as String {
  8. var text = defaultText;
  9. if (Complications has :getComplication) {
  10. var id = new Complications.Id(type);
  11. var complication = Complications.getComplication(id);
  12. if (complication != null) {
  13. text = complication.longLabel;
  14. }
  15. }
  16. return text;
  17. }
  18.  
  19. function testLabels() {
  20. var bodyBatteryLabel = getComplicationLongLabel(Complications.COMPLICATION_TYPE_BODY_BATTERY, "Body Battery");
  21. var heartRateLabel = getComplicationLongLabel(Complications.COMPLICATION_TYPE_HEART_RATE, "Heart Rate");
  22. // english: "Heart Rate", french: "Fréquence cardiaque" (the "é" is just a bug in the console output)
  23. System.println(heartRateLabel);
  24. // enlish: "Body Battery", french: "Body Battery"
  25. // (Garmin doesn't seem to translate body battery anywhere
  26. // e.g. https://www.garmin.com/fr-CA/garmin-technology/health-science/body-battery/)
  27. // "SUIVI DE L'ÉNERGIE DU CORPS BODY BATTERY™"
  28. System.println(bodyBatteryLabel);
  29. }
Advertisement
Add Comment
Please, Sign In to add comment