Merge branch 'workaround-for-not-found-english-translation-file' into 'master'

Add workaround for missing default English translation file when using Web API 2.4 or older.

See merge request openlp/web-remote!92
This commit is contained in:
Chris Witterholt 2024-04-14 18:01:48 +00:00
commit f34830dee6
4 changed files with 1316 additions and 1238 deletions

View File

@ -38,8 +38,10 @@
"@ngx-translate/core": "^15.0.0", "@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0", "@ngx-translate/http-loader": "^8.0.0",
"core-js": "^3.36.1", "core-js": "^3.36.1",
"deepmerge-ts": "^5.1.0",
"hammerjs": "^2.0.8", "hammerjs": "^2.0.8",
"material-icons": "^1.13.12", "material-icons": "^1.13.12",
"ngx-translate-multi-http-loader": "^17.0.0",
"rxjs": "^7.8.1", "rxjs": "^7.8.1",
"zone.js": "^0.14.4" "zone.js": "^0.14.4"
}, },

View File

@ -1,7 +1,7 @@
import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { BrowserModule, Title } from '@angular/platform-browser'; import { BrowserModule, Title } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { HttpClient, HttpClientModule } from '@angular/common/http'; import { HttpBackend, HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { MatButtonModule } from '@angular/material/button'; import { MatButtonModule } from '@angular/material/button';
@ -24,7 +24,7 @@ import { MatBottomSheetModule } from '@angular/material/bottom-sheet';
import { MatSliderModule } from '@angular/material/slider'; import { MatSliderModule } from '@angular/material/slider';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core'; import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader'; import { MultiTranslateHttpLoader } from 'ngx-translate-multi-http-loader';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { PageTitleService } from './page-title.service'; import { PageTitleService } from './page-title.service';
@ -54,8 +54,11 @@ import { SettingsComponent } from './components/settings/settings.component';
import { StageChordPreviewComponent } from './components/settings/stage-chord-preview/stage-chord-preview.component'; import { StageChordPreviewComponent } from './components/settings/stage-chord-preview/stage-chord-preview.component';
// AoT requires an exported function for factories // AoT requires an exported function for factories
export function createTranslateLoader(http: HttpClient) { export function HttpLoaderFactory(httpBackend: HttpBackend) {
return new TranslateHttpLoader(http, './assets/i18n/', '.json'); return new MultiTranslateHttpLoader(httpBackend, [
{ prefix: './assets/i18n/', optional: true },
{ prefix: './assets/', optional: true } // Workaround for Web API 2.4 or older to prevent HTTP 404 errors while retrieving the en.json file when using Web Remote 0.9.16 or newer.
]);
} }
@NgModule({ @NgModule({
@ -111,8 +114,8 @@ export function createTranslateLoader(http: HttpClient) {
defaultLanguage: 'en', defaultLanguage: 'en',
loader: { loader: {
provide: TranslateLoader, provide: TranslateLoader,
useFactory: (createTranslateLoader), useFactory: (HttpLoaderFactory),
deps: [HttpClient] deps: [HttpBackend]
} }
}) })
], ],

53
src/assets/en.json Normal file
View File

@ -0,0 +1,53 @@
{
"_COMMENT": "This file located here instead of in the i18n directory is a workaround for Web API 2.4 or older to prevent HTTP 404 errors while retrieving the en.json file when using Web Remote 0.9.16 or newer.",
"ADD_ITEM": "Add Item",
"ADD_ITEM_TO_SERVICE": "Add Item to Service",
"ADD_TO_SERVICE": "Add to Service",
"ALERT": "Alert",
"ALERTS": "Alerts",
"CHANGE_DISPLAY_MODE": "Change Display Mode",
"CHORD_VIEW": "Chord View",
"CHORDS": "Chords",
"CONNECTED_TO_OPENLP": "Connected to OpenLP",
"DISCONNECTED": "Disconnected",
"ENABLE_BIG_DISPLAY_BUTTONS": "Enable Big Display Buttons",
"ENABLE_FAST_SWITCHING_PANEL": "Enable Fast Switching Panel",
"FONT_SCALE": "Font Scale",
"GLOBAL": "Global",
"GO_BACK_TO_CONTROLLER": "Go Back to Controller",
"HIDE_NOTES": "Hide Notes",
"LOGIN": "Login",
"MAIN_VIEW": "Main View",
"NEXT_ITEM": "Next Item",
"NEXT_SLIDE": "Next Slide",
"NO_SEARCH_RESULTS": "No results matching your search were found",
"NO_SERVICE_ITEMS": "No Service Items",
"NO_SLIDE_ITEMS": "No Slide Items",
"PASSWORD": "Password",
"PREVIOUS_ITEM": "Previous Item",
"PREVIOUS_SLIDE": "Previous Slide",
"SEARCH": "Search",
"SEARCH_RESULTS": "Search Results",
"SEARCH_TEXT": "Search Text",
"SEND": "Send",
"SEND_AN_ALERT": "Send an Alert",
"SEND_LIVE": "Send Live",
"SERVICE": "Service",
"SETTINGS": "Settings",
"SHOW_BACKGROUND": "Show Background",
"SHOW_BLACK": "Show Black",
"SHOW_DESKTOP": "Show Desktop",
"SHOW_NOTES": "Show Notes",
"SHOW_PRESENTATION": "Show Presentation",
"SLIDES": "Slides",
"SONG": "Song",
"SONG_LEVEL_THEME_CHANGING_NOT_SUPPORTED": "Song level theme changing not supported. Change your theme level to Global or Service",
"STAGE": "Stage",
"STAGE_AND_CHORDS_APPEARANCE": "Stage and Chords Appearance",
"STAGE_VIEW": "Stage View",
"THEMES": "Themes",
"THEME_LEVEL": "Theme Level",
"THEME_OPTIONS": "Theme Options",
"USER_NAME": "User Name",
"USER_INTERFACE": "User Interface"
}

2484
yarn.lock

File diff suppressed because it is too large Load Diff