Skip to content
This repository has been archived by the owner on Sep 5, 2020. It is now read-only.

Commit

Permalink
Merge pull request #70 from thunsaker/feature/es
Browse files Browse the repository at this point in the history
Spanish Translations
  • Loading branch information
thunsaker committed Feb 3, 2016
2 parents 33e4d54 + 1599a16 commit 4cfd30d
Show file tree
Hide file tree
Showing 18 changed files with 510 additions and 141 deletions.
24 changes: 23 additions & 1 deletion appinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"appKeys": {
"address": 5,
"config": 12,
"distance": 15,
"error": 11,
"facebook": 10,
"id": 3,
Expand All @@ -14,7 +15,8 @@
"refresh": 6,
"result": 7,
"token": 0,
"twitter": 9
"twitter": 9,
"unit": 16
},
"capabilities": [
"location",
Expand Down Expand Up @@ -50,6 +52,26 @@
"file": "images/check_white.png",
"name": "IMAGE_CHECK_ON",
"type": "bitmap"
},
{
"file": "data/locale_spanish.bin",
"name": "LOCALE_SPANISH",
"type": "raw"
},
{
"file": "data/locale_german.bin",
"name": "LOCALE_GERMAN",
"type": "raw"
},
{
"file": "data/locale_french.bin",
"name": "LOCALE_FRENCH",
"type": "raw"
},
{
"file": "data/locale_english.bin",
"name": "LOCALE_ENGLISH",
"type": "raw"
}
]
},
Expand Down
29 changes: 29 additions & 0 deletions locale_english.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"187547209": "Connected to Foursquare!",
"236430616": "Share",
"278919766": "Connect to Foursquare on Phone",
"431615381": "Connection Failed. Try Again.",
"434695317": "Private Checkin",
"495054875": "Powered",
"590466778": "Checkin",
"654506729": "Venue Name",
"680250322": "Foursquare",
"785287647": "Facebook",
"1035871787": "No internet connection detected.",
"1039756945": "Cannot determine current location. :(",
"1192109149": "Error:\\n No connection to phone",
"1382248430": "Timeout :(",
"1422384485": "Share To...",
"1570984832": "Something went wrong :(",
"1662980952": "Twitter",
"1679635707": "Last Check-In",
"1720914531": "Powered by Foursquare",
"1759176004": "Checked In!",
"1805978247": "at sometime...",
"1882800246": "Error with request :(",
"1918266236": "Refreshing...",
"1963970170": "Request timed out!",
"1986659266": "Checking in...",
"1999950152": "No Address",
"2120535917": "Loading..."
}
29 changes: 29 additions & 0 deletions locale_french.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"1035871787": "No internet connection detected.",
"1039756945": "Cannot determine current location. :(",
"1192109149": "Error:\\n No connection to phone",
"1382248430": "Timeout :(",
"1422384485": "Share To...",
"1570984832": "Something went wrong :(",
"1662980952": "Twitter",
"1679635707": "Last Check-In",
"1720914531": "Powered by Foursquare",
"1759176004": "Checked In!",
"1805978247": "at sometime...",
"187547209": "Connected to Foursquare!",
"1882800246": "Error with request :(",
"1918266236": "Refreshing...",
"1963970170": "Request timed out!",
"1986659266": "Checking in...",
"1999950152": "No Address",
"2120535917": "Loading...",
"236430616": "Share",
"278919766": "Connect to Foursquare on Phone",
"431615381": "Connection Failed. Try Again.",
"434695317": "Private Checkin",
"495054875": "Powered",
"590466778": "Checkin",
"654506729": "Venue Name",
"680250322": "Foursquare",
"785287647": "Facebook"
}
29 changes: 29 additions & 0 deletions locale_german.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"1035871787": "No internet connection detected.",
"1039756945": "Cannot determine current location. :(",
"1192109149": "Error:\\n No connection to phone",
"1382248430": "Timeout :(",
"1422384485": "Share To...",
"1570984832": "Something went wrong :(",
"1662980952": "Twitter",
"1679635707": "Last Check-In",
"1720914531": "Powered by Foursquare",
"1759176004": "Checked In!",
"1805978247": "at sometime...",
"187547209": "Connected to Foursquare!",
"1882800246": "Error with request :(",
"1918266236": "Refreshing...",
"1963970170": "Request timed out!",
"1986659266": "Checking in...",
"1999950152": "No Address",
"2120535917": "Loading...",
"236430616": "Share",
"278919766": "Connect to Foursquare on Phone",
"431615381": "Connection Failed. Try Again.",
"434695317": "Private Checkin",
"495054875": "Powered",
"590466778": "Checkin",
"654506729": "Venue Name",
"680250322": "Foursquare",
"785287647": "Facebook"
}
29 changes: 29 additions & 0 deletions locale_spanish.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"187547209": "Conectado a Foursquare",
"236430616": "Compartir",
"278919766": "Conecte a Foursquare en tu móvil",
"431615381": ":( La conexión falló. Inténtalo de nuevo",
"434695317": "Check-in Privado",
"495054875": "Impulsado",
"590466778": "Check-in",
"654506729": "Nombre del Lugar",
"680250322": "Foursquare",
"785287647": "Facebook",
"1035871787": "¡No hay internet!",
"1039756945": "No pude localizar :(",
"1192109149": "Error:\\n No pudo connectar al móvil",
"1382248430": "Se falló :(",
"1422384485": "Compartir a...",
"1570984832": "Error cargando los lugares :(",
"1662980952": "Twitter",
"1679635707": "Último check-in",
"1720914531": "Impulsado por Foursquare",
"1759176004": "¡Éxito, estás aquí!",
"1805978247": "en algún momento",
"1882800246": "Error con la pedida :(",
"1918266236": "Actualizando...",
"1963970170": "Se falló :(",
"1986659266": "Haciendo check-in...",
"1999950152": "No dirección",
"2120535917": "Cargando..."
}
Binary file added resources/data/locale_english.bin
Binary file not shown.
Binary file added resources/data/locale_french.bin
Binary file not shown.
Binary file added resources/data/locale_german.bin
Binary file not shown.
Binary file added resources/data/locale_spanish.bin
Binary file not shown.
6 changes: 3 additions & 3 deletions src/checkin.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void pulse_check_tick() {
#endif

s_check_large_path = gpath_create(&CHECK_LARGE_PATH_POINTS);
text_layer_set_text(text_layer_status, checkinResult ? "Checked In!" : "Something went wrong :(");
text_layer_set_text(text_layer_status, checkinResult ? _("Checked In!") : _("Something went wrong :("));

layer_mark_dirty(layer_check);
app_timer_cancel_safe(pulse_check_timer);
Expand All @@ -128,7 +128,7 @@ void checkin_timeout_tick() {
back_color = GColorDarkGray.argb;
#endif

text_layer_set_text(text_layer_status, "Timeout :(");
text_layer_set_text(text_layer_status, _("Timeout :("));
layer_mark_dirty(layer_check);
}

Expand Down Expand Up @@ -191,7 +191,7 @@ static void window_load(Window *window) {
text_layer_set_background_color(text_layer_status, GColorClear);
text_layer_set_text_alignment(text_layer_status, GTextAlignmentCenter);
text_layer_set_font(text_layer_status, fonts_get_system_font(FONT_KEY_ROBOTO_CONDENSED_21));
text_layer_set_text(text_layer_status, "Checking in...");
text_layer_set_text(text_layer_status, _("Checking in..."));
layer_add_child(window_layer, text_layer_get_layer(text_layer_status));

// Check
Expand Down
7 changes: 4 additions & 3 deletions src/checkin_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "checkin.h"
#include "colors.h"
#include "share_menu.h"
#include <localize.h>

#define NUM_MENU_SECTIONS 1
#define NUM_MENU_ITEMS 3
Expand Down Expand Up @@ -68,10 +69,10 @@ static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuI
default:
switch (cell_index->row) {
case 0:
menu_cell_basic_draw(ctx, cell_layer, "Checkin", NULL, NULL);
menu_cell_basic_draw(ctx, cell_layer, _("Checkin"), NULL, NULL);
break;
case 1:
menu_cell_basic_draw(ctx, cell_layer, "Share", NULL, NULL);
menu_cell_basic_draw(ctx, cell_layer, _("Share"), NULL, NULL);
GRect bounds = layer_get_bounds(cell_layer);
char* alligators = ">>";
GFont font = fonts_get_system_font(FONT_KEY_GOTHIC_24_BOLD);
Expand All @@ -84,7 +85,7 @@ static void menu_draw_row_callback(GContext* ctx, const Layer *cell_layer, MenuI
NULL);
break;
case 2:
menu_cell_basic_draw(ctx, cell_layer, "Private Checkin", NULL, NULL);
menu_cell_basic_draw(ctx, cell_layer, _("Private Checkin"), NULL, NULL);
break;
}
break;
Expand Down
13 changes: 7 additions & 6 deletions src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@
#pragma once

#include <pebble.h>
#include <localize.h>

typedef struct {
char id[25];
char name[128];
char address[128];
char distance[10];
int distance_unit;
int index;
bool isRecent;
} SpoonVenue;
Expand All @@ -27,7 +30,9 @@ enum {
SPOON_ERROR = 0xB,
SPOON_CONFIG = 0xC,
SPOON_RECENT = 0xD,
SPOON_READY = 0xE
SPOON_READY = 0xE,
SPOON_DISTANCE = 0xF,
SPOON_UNIT = 0x10
};

#define KEY_TOKEN 10
Expand All @@ -37,8 +42,4 @@ enum {
#define STATUS_BAR_OFFSET 0
#else
#define STATUS_BAR_OFFSET 12
#endif

#define DIALOG_MESSAGE_NOT_CONNECTED "Connect to Foursquare on Phone"
#define DIALOG_MESSAGE_NO_PHONE "Error:\n No connection to phone"
#define DIALOG_MESSAGE_NO_LOCATION "No Location"
#endif
58 changes: 58 additions & 0 deletions src/hash.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
#pragma once

#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>

#ifndef MIN
#define MIN(a, b) ((a) < (b)) ? (a) : (b)
#endif

// Required for inlining static with -Os during pre-processor
#define FORCE_INLINE __attribute__((always_inline)) inline

// Supports strings up to 128 long by using 8 16-byte chunks
#define HASH_DJB2_128(s, len) \
(\
(hash_djb2(s+112, MIN((len - 112),16), \
(hash_djb2(s+96, MIN((len - 96),16), \
(hash_djb2(s+80, MIN((len - 80),16), \
(hash_djb2(s+64, MIN((len - 64),16), \
(hash_djb2(s+48, MIN((len - 48),16), \
(hash_djb2(s+32, MIN((len - 32),16), \
(hash_djb2(s+16, MIN((len - 16),16), \
(hash_djb2(s,MIN(len,16),5381)))))))))))))))) \
)

#define HASH_DJB2_NX(s) (HASH_DJB2_128(s, (int32_t)strlen(s)) & 0x7FFFFFFF)
#define HASH_DJB2(s) HASH_DJB2_NX(s)

// GCC preprocessor will only preprocess this up to 18 characters, so only do 16
// Based on DJB2 Hash, use 5381 as initial seed
static FORCE_INLINE uint32_t hash_djb2(
const char* bytes, const int32_t length, const uint32_t oldhash) {
uint32_t hash = oldhash;

if (length <= 0) return hash;

// Manually unrolled with scope 1 to be compatible with Os
if(length > 0) hash = ((hash << 5) + hash) + bytes[0];
if(length > 1) hash = ((hash << 5) + hash) + bytes[1];
if(length > 2) hash = ((hash << 5) + hash) + bytes[2];
if(length > 3) hash = ((hash << 5) + hash) + bytes[3];
if(length > 4) hash = ((hash << 5) + hash) + bytes[4];
if(length > 5) hash = ((hash << 5) + hash) + bytes[5];
if(length > 6) hash = ((hash << 5) + hash) + bytes[6];
if(length > 7) hash = ((hash << 5) + hash) + bytes[7];
if(length > 8) hash = ((hash << 5) + hash) + bytes[8];
if(length > 9) hash = ((hash << 5) + hash) + bytes[9];
if(length > 10) hash = ((hash << 5) + hash) + bytes[10];
if(length > 11) hash = ((hash << 5) + hash) + bytes[11];
if(length > 12) hash = ((hash << 5) + hash) + bytes[12];
if(length > 13) hash = ((hash << 5) + hash) + bytes[13];
if(length > 14) hash = ((hash << 5) + hash) + bytes[14];
if(length > 15) hash = ((hash << 5) + hash) + bytes[15];

return hash;
}
Loading

0 comments on commit 4cfd30d

Please sign in to comment.