Browse Source

Update logo; add i18n support

master
Garrett Mills 10 months ago
parent
commit
71d316d122
Signed by: garrettmills GPG Key ID: D2BF5FBA8298F246
  1. 14
      ex
  2. 1
      package.json
  3. 2
      pnpm-lock.yaml
  4. 2
      src/Units.extollo.ts
  5. 5
      src/app/configs/lang/common.config.ts
  6. 6
      src/app/configs/lang/en_US.config.ts
  7. 7
      src/app/http/controllers/main/Home.controller.ts
  8. 6
      src/app/resources/views/welcome.pug

14
ex

@ -3,12 +3,14 @@
ENV_NODE="$(which node)"
ENV_PNPM="$(which pnpm)"
LOGO=" ______ _ _ _
| ____| | | | | |
| |__ __ _| |_ ___ | | | ___
| __| \\ \\/ / __/ _ \\| | |/ _ \\
| |____ > <| || (_) | | | (_) |
|______/_/\\_\\\\__\\___/|_|_|\\___/"
LOGO=" _
/ /\ ______ _ _ _
/ / \ | ____| | | | | |
/ / /\ \ | |__ __ _| |_ ___ | | | ___
/ / /\ \ \ | __| \ \/ / __/ _ \| | |/ _ \\
/ / / \ \_\ | |____ > <| || (_) | | | (_) |
\/_/ \/_/ |______/_/\_\\\__\___/|_|_|\___/
"
# Author: Tasos Latsas

1
package.json

@ -12,6 +12,7 @@
"@extollo/lib": "file:../lib",
"@extollo/orm": "file:../orm",
"@extollo/cli": "file:../cli",
"@extollo/i18n": "file:../i18n",
"copyfiles": "^2.4.1",
"typescript": "^4.1.3"
},

2
pnpm-lock.yaml

@ -1,6 +1,7 @@
dependencies:
'@extollo/cli': link:../cli
'@extollo/di': link:../di
'@extollo/i18n': link:../i18n
'@extollo/lib': link:../lib
'@extollo/orm': link:../orm
copyfiles: 2.4.1
@ -297,6 +298,7 @@ packages:
specifiers:
'@extollo/cli': file:../cli
'@extollo/di': file:../di
'@extollo/i18n': file:../i18n
'@extollo/lib': file:../lib
'@extollo/orm': file:../orm
copyfiles: ^2.4.1

2
src/Units.extollo.ts

@ -1,6 +1,7 @@
import {Config, Controllers, HTTPServer, Middlewares, Routing, Unit} from '@extollo/lib'
import {Database, Models} from "@extollo/orm";
import {CommandLine} from "@extollo/cli";
import {Internationalization} from "@extollo/i18n";
export const Units = [
Config,
@ -9,6 +10,7 @@ export const Units = [
Middlewares,
Database,
Models,
Internationalization,
Routing,
HTTPServer,

5
src/app/configs/lang/common.config.ts

@ -0,0 +1,5 @@
import { env } from "@extollo/lib"
export default {
app_name: env('APP_NAME', 'Extollo'),
}

6
src/app/configs/lang/en_US.config.ts

@ -0,0 +1,6 @@
import {env} from '@extollo/lib'
export default {
welcome_to_extollo: 'Welcome to Extollo!',
viewed_page_num_times: 'You have viewed this page :num: times.',
}

7
src/app/http/controllers/main/Home.controller.ts

@ -1,16 +1,21 @@
import {Controller, view, Session} from '@extollo/lib';
import {Inject, Injectable} from "@extollo/di";
import {Locale} from "@extollo/i18n"
@Injectable()
export class Home extends Controller {
@Inject()
protected readonly session!: Session;
@Inject()
protected readonly locale!: Locale;
public welcome() {
this.session.set('app_visits', this.session.get('app_visits', 0) + 1)
return view('welcome', {
app_visits: this.session.get('app_visits')
app_visits: this.session.get('app_visits'),
locale: this.locale.helper(),
})
}
}

6
src/app/resources/views/welcome.pug

@ -1,6 +1,6 @@
html
head
title Welcome | Extollo
title !{locale('app_name')}
body
h1 Welcome to Extollo
h2 You have viewed this page !{app_visits} times.
h1 !{locale('welcome_to_extollo')}
h2 !{locale('viewed_page_num_times', { interp: { num: app_visits } })}

Loading…
Cancel
Save