mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2025-11-12 15:52:56 +10:00
fix(i18n): load translations from fs
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
import { Controller, Get, Header, Param } from "@nestjs/common";
|
||||
import { Controller, Get, Param } from "@nestjs/common";
|
||||
|
||||
import { UtilsService } from "../utils/utils.service";
|
||||
import { TranslationService } from "./translation.service";
|
||||
@ -20,8 +20,6 @@ export class TranslationController {
|
||||
}
|
||||
|
||||
@Get("/:locale")
|
||||
@Header("Content-Type", "application/octet-stream")
|
||||
@Header("Content-Disposition", 'attachment; filename="messages.po"')
|
||||
async translation(@Param("locale") locale: string) {
|
||||
return this.utils.getCachedOrSet(
|
||||
`translation:${locale}`,
|
||||
|
||||
@ -31,6 +31,7 @@ export class TranslationService {
|
||||
}
|
||||
|
||||
async fetchLanguages() {
|
||||
const isDevelopment = this.configService.get("NODE_ENV") === "development";
|
||||
const projectId = this.configService.get("CROWDIN_PROJECT_ID");
|
||||
const accessToken = this.configService.get("CROWDIN_ACCESS_TOKEN");
|
||||
|
||||
@ -40,6 +41,20 @@ export class TranslationService {
|
||||
);
|
||||
const { data } = response.data as CrowdinResponse;
|
||||
|
||||
if (isDevelopment) {
|
||||
data.push({
|
||||
data: {
|
||||
language: {
|
||||
id: "zu-ZA",
|
||||
locale: "zu-ZA",
|
||||
editorCode: "zuza",
|
||||
name: "Psuedo Locale",
|
||||
},
|
||||
translationProgress: 100,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
return data.map(({ data }) => {
|
||||
return {
|
||||
id: data.language.id,
|
||||
|
||||
Reference in New Issue
Block a user