Skip to content

Commit

Permalink
Adds Spanish translation
Browse files Browse the repository at this point in the history
  • Loading branch information
hallettj committed Feb 3, 2014
1 parent 2a753c1 commit 818e076
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 2 deletions.
3 changes: 3 additions & 0 deletions resources/configure-fuzzy-text.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ <h1>Configure Fuzzy Text</h1>
<input type="radio" name="lang" value="en" id="lang-en" checked="checked" class="custom" />
<label for="lang-en">English</label>

<input type="radio" name="lang" value="es" id="lang-es" checked="checked" class="custom" />
<label for="lang-es">Español</label>

<input type="radio" name="lang" value="sv" id="lang-sv" class="custom" />
<label for="lang-sv">Svenska</label>
</fieldset>
Expand Down
3 changes: 2 additions & 1 deletion src/js/pebble-js-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ var alignments = {
var langs = {
de: 0,
en: 1,
sv: 2
es: 2,
sv: 3
};

function readyCallback(event) {
Expand Down
7 changes: 7 additions & 0 deletions src/num2words.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "num2words.h"
#include "strings-de.h"
#include "strings-en.h"
#include "strings-es.h"
#include "strings-sv.h"
#include "string.h"

Expand Down Expand Up @@ -47,6 +48,9 @@ const char* get_hour(Language lang, int index) {
case DE:
return HOURS_DE[index];
break;
case ES:
return HOURS_ES[index];
break;
case SV:
return HOURS_SV[index];
break;
Expand All @@ -60,6 +64,9 @@ const char* get_rel(Language lang, int index) {
case DE:
return RELS_DE[index];
break;
case ES:
return RELS_ES[index];
break;
case SV:
return RELS_SV[index];
break;
Expand Down
3 changes: 2 additions & 1 deletion src/num2words.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
typedef enum {
DE = 0x0,
EN = 0x1,
SV = 0x2
ES = 0x2,
SV = 0x3
} Language;

void time_to_words(Language lang, int hours, int minutes, int seconds, char* words, size_t length);
54 changes: 54 additions & 0 deletions src/strings-es.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#include "strings-en.h"

const char* const HOURS_ES[] = {
// AM hours
"doce",
"una",
"dos",
"tres",
"cuatro",
"cinco",
"seis",
"siete",
"ocho",
"nueve",
"diez",
"once",

// PM hours
"doce",
"una",
"dos",
"tres",
"cuatro",
"cinco",
"seis",
"siete",
"ocho",
"nueve",
"diez",
"once"
};

/**
* The string "$1" will be replaced with the current hour (e.g., "three"
* at 3:45). The string "$2" will be replaced with the *next* hour
* (e.g., "four" at 3:45).
*
* A "*" character before a word makes that word bold.
*/
const char* const RELS_ES[] = {
"$1",
"*$1 y cinco",
"*$1 y diez",
"*$1 y cuarto",
"*$1 y veinte",
"*$1 y veinte- cinco",
"*$1 y media",
"*$2 menos veinte- cinco",
"*$2 menos veinte",
"*$2 menos cuarto",
"*$2 menos diez",
"*$2 menos cinco"
};

5 changes: 5 additions & 0 deletions src/strings-es.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once

const char* const HOURS_ES[24];
const char* const RELS_ES[12];

0 comments on commit 818e076

Please sign in to comment.