Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

L10n es #52

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Next Next commit
first exercise ready to test
  • Loading branch information
demipel8 committed Dec 9, 2016
commit 5d7d0829cec275611a699bddd49c88d2d634033d
70 changes: 70 additions & 0 deletions exercises/hello_koa/problem.es.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
Crea un servidor en koa que escucha en un puerto especificado por linea de comandos y responde con "hola koa" cuando recibe una petición HTTP GET a /.

El workshop ejecutara las peticiones al servidor y verificara la salida.

PISTAS

Para todos los ejercicios, necesitamos koa.

Para instalar koa:

```
npm install koa
```
También necesitamos node 0.11.9+ para poder ejecutar aplicaciones koa, puedes usar nvm para instalar node 0.11.9 o superior (ej. 0.12):

```
/~https://github.com/creationix/nvm
```

Si estas en Windows, usa el equivalente nvmw:

```
/~https://github.com/hakobera/nvmw
```

Crea un servidor que escucha en el número de puerto dado con el código que viene a continuación:

```
var koa = require('koa');
var app = koa();

// los manejadores aquí
// app.use(handlers);

app.listen(port);
```

Puedes obtener el puerto con

```
var port = process.argv[2];
```

Los manejadores (handlers) pueden ser funciones generadores anónimas o declaradas por separado (como en javascript :P):

```
app.use(function *() {
// puedes asignar el cuerpo de la respuesta en un manejador así
this.body = 'hello';
});
```
Puedes leer más sobre las funciones generador de ECMAScript 6 aquí:

```
https://developer.mozilla.org/es/docs/Web/JavaScript/Referencia/Sentencias/function*
```


O con el workshop “Learn Generators” de NodeSchool:

```
/~https://github.com/isRuslan/learn-generators
```


El Contexto(`this` en middlewares)) de Koa encapsula los objetos `request` y `response` de node en un único objeto para ofrecer múltiples métodos que ayuden a escribir aplicaciones web y APIs. Para aprender mas sobre el Contexto de Koa, por favor visita la web de Koa:

```
http://koajs.com
```
9 changes: 9 additions & 0 deletions exercises/hello_koa/solution_es/solution.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
var koa = require('koa');

var app = koa();

app.use(function* () {
this.body = 'hola koa';
});

app.listen(process.argv[2]);
1 change: 1 addition & 0 deletions exercises/hello_koa/solution_es/solution.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hola koa
Empty file added i18n/credits/es.txt
Empty file.
77 changes: 77 additions & 0 deletions i18n/es.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"title": "KICK OFF KOA",
"subtitle": "\u001b[23mSelecciona un ejercicio y dale a \u001b[3mEnter\u001b[23m para empezar",
"menu": {
"credits": "CRÉDITOS"
},
"common": {
"exercise": {
"fail": {
"cannot_connect": " Error intentando conectar con el servidor %s (http://localhost:%s%s), opciones: %j. %s"
},
"server_type": {
"submission": "presentación"
}
}
},
"exercise": {
"HELLO_KOA": "HOLA KOA",
"ROUTING": "ROUTING",
"REQUEST_BODY": "REQUEST_BODY",
"RESPONSE_BODY": "RESPONSE_BODY",
"CONTENT_HEADERS": "CONTENIDO DE LOS HEADERS",
"MIDDLEWARE": "MIDDLEWARE",
"ERROR_HANDLING": "MANEJO DE ERRORES",
"COOKIE": "COOKIE",
"SESSION": "SESIÓN",
"TEMPLATING": "PLANTILLAS (TEMPLATING)",
"AUTHENTICATION": "AUTENTICACIÓN"
},
"exercises": {
"ROUTING": {
"log_format": "cuerpo de la respuesta para `%s`: %s"
},
"REQUEST_BODY": {
"log_conversion": "convertir `%s` a `%s`"
},
"RESPONSE_BODY": {
"log_body": "cuerpo de la respuesta para `%s`: %s",
"log_ctype": "`%s` respond content-type: %s",
"log_encoding": "`%s` respond transfer-encoding: %s"
},
"MIDDLEWARE": {
"log_uppercase": "`upperCase` middleware convert response body to \"%s\"",
"log_response_time": "`responseTime` middleware set `X-Response-Time` header"
},
"ERROR_HANDLING": {
"log_body": "responds \"%s\" when requesting `%s`",
"log_status": "response status is %d when requesting `%s`"
},
"COOKIE": {
"fail.unset_cookie": "cookie.view not set",
"fail.set_unsigned": "ctx.cookies.set should set options.signed = true",
"fail.get_unsigned": "ctx.cookies.get should set options.signed = true",
"log.first_visit": "first visit: %s",
"log.visit_again": "visit again: %s",
"log.signed": "signed cookie can not be tampered",
"output.one_view": "1 views"
},
"SESSION": {
"log.first_visit": "first visit: %s",
"log.visit_again": "visit again: %s",
"log.new_user_visit": "new user visit page: %s"
},
"AUTHENTICATION": {
"fail.no_initial_401": "GET / : non-logged-in user should get 401 error, but got %d",
"fail.no_auth_check": "POST /login : incorrect username or password must return 400 error",
"fail.no_login_redirect": "POST /login : user should be redirected to `/`",
"fail.no_logout_redirect": "GET /logout : user should be redirected to `/login`",
"fail.no_final_401": "GET / : logged-out user should get 401 error",
"log.initial_401": "GET / : non-logged-in user get 401 error",
"log.auth_check": "POST /login : 400 error when incorrect username or password",
"log.login_redirect": "POST /login : login successful",
"log.logout_redirect": "GET /logout : user is redirected to `/login`",
"log.final_401": "GET / : logged-out user get 401 error"
}
}
}
Empty file added i18n/help/es.txt
Empty file.
2 changes: 1 addition & 1 deletion kick-off-koa.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function fpath (f) {
Workshopper({
name : name,
appDir : __dirname,
languages : ['en', 'fr'],
languages : ['en', 'fr', 'es'],
helpFile : fpath('./i18n/help/{lang}.txt'),
menuItems : [{
name : 'credits',
Expand Down