Added languages getter

This commit is contained in:
Alexander Cerutti
2021-10-31 20:54:31 +01:00
parent 7a417e45c5
commit a0cdc218dd
4 changed files with 52 additions and 12 deletions

View File

@@ -8,8 +8,6 @@ import { app } from "./webserver";
import { getCertificates } from "./shared";
import path from "path";
import { PKPass } from "passkit-generator";
/** Symbols are exported just for tests and examples. Replicate only if really needed. */
import { localizationSymbol } from "passkit-generator/lib/PKPass";
app.route("/localize/:modelName").get(async (request, response) => {
const passName =
@@ -51,10 +49,7 @@ app.route("/localize/:modelName").get(async (request, response) => {
// This language does not exist but is still added as .lproj folder
pass.localize("zu", {});
console.log(
"Added languages",
Object.keys(pass[localizationSymbol]).join(", "),
);
console.log("Added languages", Object.keys(pass.languages).join(", "));
const stream = pass.getAsStream();

View File

@@ -1,7 +1,6 @@
import { finish400WithoutModelName, createPassGenerator } from "../shared";
import type { ALBEvent, ALBResult } from "aws-lambda";
import type { PKPass } from "passkit-generator";
import { localizationSymbol } from "passkit-generator/lib/PKPass";
/**
* Lambda for localize example
@@ -36,10 +35,7 @@ export async function localize(event: ALBEvent) {
LOCATION: "plassering",
});
console.log(
"Added languages",
Object.keys(pass[localizationSymbol]).join(", "),
);
console.log("Added languages", Object.keys(pass.languages).join(", "));
return (await passGenerator.next(pass as PKPass)).value as ALBResult;
}