Update logo; add i18n support

This commit is contained in:
Garrett Mills 2021-03-22 12:07:33 -05:00
parent 024a371590
commit 71d316d122
Signed by: garrettmills
GPG Key ID: D2BF5FBA8298F246
8 changed files with 33 additions and 10 deletions

14
ex
View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -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.',
}

View File

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

View File

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