Skip to content
This repository has been archived by the owner on Nov 26, 2022. It is now read-only.

Commit

Permalink
v7.1
Browse files Browse the repository at this point in the history
Improvements on Norge
  • Loading branch information
dieghernan committed May 25, 2017
1 parent 1f88b87 commit 48792cb
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 21 deletions.
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,15 @@
{
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"file": "fonts/Gotham Light.otf",
"name": "FONT_GLIGHT_30",
"name": "FONT_GLIGHT_22",
"targetPlatforms": null,
"trackingAdjust": -2,
"type": "font"
},
{
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"characterRegex": "[a-z .' A-Z 0-9 \u00e4\u00e1\u00e9\u00ed\u00f3\u00fa\u00f6\u00fc\u00fb\u00ea \u00e5\u00f8\u016d]",
"file": "fonts/Gotham Light.otf",
"name": "FONT_GLIGHT_34",
"name": "FONT_GLIGHT_16",
"targetPlatforms": null,
"trackingAdjust": -2,
"type": "font"
},
{
Expand All @@ -78,29 +76,33 @@
"type": "font"
},
{
"characterRegex": "[a-z .' A-Z 0-9 \u00e4\u00e1\u00e9\u00ed\u00f3\u00fa\u00f6\u00fc\u00fb\u00ea \u00e5\u00f8\u016d]",
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"file": "fonts/Gotham Light.otf",
"name": "FONT_GLIGHT_16",
"name": "FONT_GLIGHT_34",
"targetPlatforms": null,
"trackingAdjust": -2,
"type": "font"
},
{
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"file": "fonts/Gotham Light.otf",
"name": "FONT_GLIGHT_22",
"name": "FONT_GLIGHT_30",
"targetPlatforms": null,
"trackingAdjust": -2,
"type": "font"
},
{
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"file": "fonts/Gotham Bold.otf",
"name": "FONT_GBOLD_16",
"name": "FONT_GBOLD_22",
"targetPlatforms": null,
"trackingAdjust": -1,
"type": "font"
},
{
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"file": "fonts/Gotham Bold.otf",
"name": "FONT_GBOLD_39",
"name": "FONT_GBOLD_30",
"targetPlatforms": null,
"trackingAdjust": -1,
"type": "font"
Expand All @@ -116,17 +118,15 @@
{
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"file": "fonts/Gotham Bold.otf",
"name": "FONT_GBOLD_30",
"name": "FONT_GBOLD_39",
"targetPlatforms": null,
"trackingAdjust": -1,
"type": "font"
},
{
"characterRegex": "[a-z ' UV\u00f6\u00fc\u00e9\u00fb\u00ea\u016d \\-\u00e5\u00e4\u00f8]",
"file": "fonts/Gotham Bold.otf",
"name": "FONT_GBOLD_22",
"name": "FONT_GBOLD_16",
"targetPlatforms": null,
"trackingAdjust": -1,
"type": "font"
},
{
Expand All @@ -150,5 +150,5 @@
"watchface": true
}
},
"version": "7.0.0"
"version": "7.1.0"
}
5 changes: 4 additions & 1 deletion src/c/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ void writetimeto3words(int hour_i,int minute_i,int *linebold_i,char *line1_i, ch
else if (lang_i==7){ //Norwegian
time_to_3words_NN(hour_i , minute_i,linebold_i ,line1_i, line2_i, line3_i);
}
else if (lang_i==71){ //Norwegian Colloquial
time_to_3words_NN2(hour_i , minute_i,linebold_i ,line1_i, line2_i, line3_i);
}
else if (lang_i==8){ //Danish
time_to_3words_DK(hour_i , minute_i,linebold_i ,line1_i, line2_i, line3_i);
}
Expand Down Expand Up @@ -144,7 +147,7 @@ void writedatelang(int week,int Mon,int Day, char* iterwd,char * iterdat, char *
else if (Lang==6){ //Italian
WriteDate_IT(week , Mon ,Day, iterwd ,iterdat,itermon);
}
else if (Lang==7){ //Norwegian
else if (Lang==7 || Lang==71){ //Norwegian
WriteDate_NN(week , Mon ,Day, iterwd ,iterdat,itermon);
}
else if (Lang==8){ //Danish
Expand Down
73 changes: 69 additions & 4 deletions src/c/num2words-nn.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,19 @@ static const char* const HOUR_NN[] = {
"tolv",
"ett"
};
static const char* const MIN_NN_C[]={
"",
"en",
"to",
"tre",
"fire",
"fem",
"seks",
"sju",
"åtte",
"ni",
"ti"
};
static const char* const MIN_NN1[]={
"klokka er",
"ett",
Expand All @@ -34,7 +47,19 @@ static const char* const MIN_NN1[]={
"tolv",
"tretten",
"fjorten",
"kvart"
"kvart",
"seksten",
"sytten",
"atten",
"nitten"
};
static const char* const MIN_NNAUX[] = {
"null",
"",
"tjue",
"tretti",
"førti",
"femti"
};
//Init_StrMonthDat: Create strings for Months and Days
const char* const MONTHS_NN[] = {
Expand Down Expand Up @@ -62,10 +87,12 @@ const char* const WEEKDAY_NN[] = {
};
//End_Weekday
void time_to_3words_NN(int hours, int minutes, int *LineBold,char *line1, char *line2, char *line3){
//Clean line3 at init
//Clean lines at init
strcpy(line1,"");
strcpy(line2, "");
strcpy(line3, "");
//shift 1 hour the label for this minutes
if ( minutes>15) {hours=(hours+1);}
if ( minutes>=20) {hours=(hours+1);}
//Exceptions first
hours=hours % 12;
if (minutes==0 || minutes==30){
Expand All @@ -79,7 +106,7 @@ void time_to_3words_NN(int hours, int minutes, int *LineBold,char *line1, char *
*LineBold=2;
}
else {
if (minutes<=15){
if (minutes<=19){
strcpy(line1,MIN_NN1[minutes]);
strcpy(line2,"over");
}
Expand All @@ -99,6 +126,44 @@ void time_to_3words_NN(int hours, int minutes, int *LineBold,char *line1, char *
*LineBold=3;
}
}
void time_to_3words_NN2(int hours, int minutes, int *LineBold,char *line1, char *line2, char *line3){
//Clean lines at init
strcpy(line1,"");
strcpy(line2, "");
strcpy(line3, "");
//Line 1 is always hour except at oclock
hours=hours % 12;
if (minutes==0){
strcpy(line1,MIN_NN1[minutes]);
strcpy(line2,HOUR_NN[hours]);
*LineBold=2;
strcpy(line3,"");
}
else {
strcpy(line1, HOUR_NN[hours]);
*LineBold=1;
//Line2
if (minutes<10){
strcpy(line2,MIN_NNAUX[0]);
}
else if (minutes>=20){
strcpy(line2,MIN_NNAUX[minutes/10]);
}
else if (minutes==15){
strcpy(line2,"femten");
}
else {
strcpy(line2,MIN_NN1[minutes]);
}
//Line3
if (minutes%10==0){
strcpy(line3,"");
}
else if (minutes<=9 || minutes>=20){
strcpy(line3, MIN_NN_C[minutes%10]);
}
}
}
void WriteDate_NN(int WD, int Mnth, int Dy, char *iterweekday, char *iterdate, char *itermonth ){
strcpy(iterweekday, WEEKDAY_NN[WD]);
snprintf(iterdate, sizeof(iterdate), "%d.", Dy);
Expand Down
1 change: 1 addition & 0 deletions src/c/num2words-nn.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#pragma once
#include "string.h"
void time_to_3words_NN(int hours, int minutes,int *LineBold, char *line1, char *line2, char *line3);
void time_to_3words_NN2(int hours, int minutes,int *LineBold, char *line1, char *line2, char *line3);
void WriteDate_NN(int WD, int Mnth, int Dy, char *iterweekday, char *iterdate, char *itermonth );
3 changes: 2 additions & 1 deletion src/pkjs/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ module.exports = [
{"label":"Portuguese (Brazil)", "value": "5" },
{"label":"Italian", "value": "6" },
{"label":"Norwegian", "value": "7"},
{"label":"Norwegian (colloquial)", "value": "71"},
{"label":"Danish", "value": "8"},
{"label":"Swedish", "value": "9"},
{"label":"Esperanto", "value": "10"},
Expand Down Expand Up @@ -187,7 +188,7 @@ module.exports = [
},
{
"type": "heading",
"defaultValue": "Version v7.0",
"defaultValue": "Version v7.1",
"size":6
} ,
{
Expand Down

0 comments on commit 48792cb

Please sign in to comment.