cost 250 ms
如何讓 transloco 讀取不同的文件

[英]How to get transloco to read from different files

我在 Angular 項目 transloco 中使用多語言。 在這個項目中,我還導入了一個帶有模塊聯合的微前端。 微前端模塊有自己的翻譯字典文件,可以正常使用,但是一旦在shell中導入,transloco似乎只使用了shell模塊的文件,而不是微前端。 有沒有辦法告訴 transloco 從多個 ...

在Action的構造時添加類似type的默認屬性

[英]Add default property similar to type in construct time of Action

我想創建一個將由所有成功事件觸發的效果,並拋出一個帶有與該操作相關的翻譯的成功小吃店。 我只想將此翻譯鍵添加到操作中一次,這樣我就不需要在發送時添加它。 列表.action.tsexport const listActions = createActionGroup({ source: 'Lis ...

將通用 Transloco 配置與項目特定變量相結合

[英]Combine common Transloco config with project-specific variable

我正在嘗試在我的 Angular 應用程序中實施 Transloco,該應用程序由一個庫和多個 SPA 項目組成。 我想在庫項目common中有一個全局配置 class,並使用庫無法訪問的生產模式變量對其進行擴展。 目前,我有以下工作配置架構: transloco-common-config.mo ...

如何檢查翻譯文件是否已在 transloco 中加載?

[英]How to check if a translation file has been loaded in transloco?

我有一個 Angular 14 項目,我最近添加了 transloco。 它運行良好,但它也使用了一些 PrimeNG,每次切換語言時我都必須提供正確的 i18n 翻譯。 這就是我現在所擁有的: 這很好用,但是當我第一次切換語言時,我在控制台中收到很多錯誤,警告我翻譯尚未准備好: ngneat- ...

如何將字符串和變量的混合傳遞到 routerLink 進行導航?

[英]How to pass a mixture of string and variable into routerLink for navigation?

我正在使用我使用transloco實現的語言切換器幫助在 Angular Web 應用程序中實現本地化。 transloco的工作方式是在 URL 中的域之后添加兩位數的語言代碼/en/ ,而終點和子位置緊跟在語言代碼之后。 這是在我實施本地化之前運行良好的舊代碼: 因此,為了在應用程序加載后 ...

在 Angular 項目中安裝 Transloco 錯誤

[英]Installing Transloco in Angular project error

我正在嘗試在我的 Angular 項目中添加 Transloco,我收到以下錯誤我的 Angular 項目是 12.1.5,你知道我該如何解決它。 我嘗試首先安裝 Transloco 它給出了同樣的錯誤然后我嘗試了ng add @ngneat/transloco它給出了同樣的錯誤 ...

Transloco 依賴沖突

[英]Transloco dependency conflict

我正在嘗試將 Transloco 包添加到我在 VSCode 中編譯的 Angular Ionic 項目中。 我正在運行 Angular 版本 13.3.0 當我運行安裝命令時: 我收到以下終端錯誤: 終端錯誤 我嘗試使用 npm-update --force {package} 強制各個庫更 ...

在 Angular Lib 中無法將 TRANSLOCO 與 Storybook 一起使用

[英]Can't use TRANSLOCO with Storybook in Angular Lib

我正在研究一個 Angular 13 庫,我想實現故事書,所有庫的組件都包括 TRANSLOCO。 所以,當我創建故事時,我看不到它們,因為我有這樣的問題: NG0302: The pipe 'transloco' could not be found in the 'InputTextCompo ...

ngOnInit() 中的 Angular Transloco 用法

[英]Angular Transloco usage in ngOnInit()

我知道以下代碼不起作用,因為在調用ngOnInit()時尚未加載翻譯文件en.json : 組件.ts en.json 另一種選擇是訂閱: 但是在我的組件中,我有 30 個需要翻譯的鍵。 我真的應該訂閱所有 30 個鍵嗎? 演示: https : //stackblitz.com ...

Transloco 在我的 Angular 12 Prod Build 中不起作用,而在我的 DEV 版本中工作。 我可能會錯過什么?

[英]Transloco does NOT work in my Angular 12 Prod Build, while it works in my DEV build. What could I be missing?

當我使用npm start在本地運行我的 Angular 12 應用npm start ,Transloco 翻譯工作正常。 但是,當我使用http-server dist/my-project運行我的應用程序時,在ng build --configuration production之后,翻譯不 ...

如果無法導入 TranslocoService,如何翻譯 const 文件?

[英]How do I translate const files if I can't import TranslocoService?

介紹 你好,我有一個 Angular+Ionic 項目,我正在使用 Transloco 來翻譯一些文本。 問題 我有一個包含字符串的 consts 文件,我希望能夠在同一個文件中翻譯它們,但我不知道如何執行此操作,因為我無法在 consts 文件中導入 TranslocoService。 代碼 ...

如何檢查 transloco 中丟失的翻譯鍵?

[英]How to check missing translation keys in transloco?

我目前正在使用 Transloco 在 angular 應用程序中進行翻譯。 我的資產中有 2 個文件: en.json 值: { "firstName": "名字", "lastName": "姓氏", "地址": "地址" } fr.json 具有值(缺少姓氏): { “firstNa ...

離子構建后無法加載 i18N 文件

[英]Failed to load i18N files after ionic build

運行 NG Build 生成 PWA 解決方案后,找不到 transloc 翻譯的 i18n 文件。 我查找了文件指向的位置,但沒有找到。 正確的 url 是 http://localhost/mydomain/assets/i18n/en-US.json transloco-root.modu ...

Transloco translateService.translate 在 app.component.ts 中不起作用

[英]Transloco translateService.translate does not work in app.component.ts

如果我在我的 app.component.ts 構造函數中輸入以下內容,它不起作用。 但是,如果我在子模塊中輸入相同的代碼,它就可以正常工作。 這是我的 .json 文件: 在我的 app.module.ts 中,也導入了 TranslocoRootModule。 我錯過了什么嗎? ...

通過 Transloco 加載的陣列上的 Angular ngFor

[英]Angular ngFor on an array loaded via Transloco

我正在使用 Transloco 在 angular10 項目中管理多種語言。 我創建了一個這樣的 json i18n 文件: 在我的模板中,我正在嘗試像這樣從我的文件中加載值: 我想為 datalist 的每個元素創建一個 tile,angular 不會拋出異常。 但是,它不加載任何內容(t ...

如何在 Angular 的“餅圖”上使用“transloco”?

[英]How to use 'transloco' on `pie-chart` in Angular?

這是我的代碼: .HTML: .TS: fa.JSON: 在控制台內,我看到name像: 將分配給chart-pie的single JSON 如下所示: 但我想做的是將pie-chart標簽更改為翻譯后的名稱。 我的圖表現在看起來像這樣,表明transloco無法正常工作 ...

Transloco 語言環境。 如何添加自定義日期過濾器?

[英]Transloco Locale. How to add custom date filter?

我正在嘗試將transloco locale默認提供的日期過濾器擴展為其他一些滿足我們客戶要求的過濾器。 但是,文檔沒有提供關於此的示例或很好的解釋。 你們中有人設法將自定義過濾器添加到 transloco 語言環境庫嗎? 我發現東西的唯一地方就是這里,並沒有多大幫助。 它沒有說我應該在哪里調用這 ...

NullInjectorError:沒有 InjectionToken DEFAULT_LOCALE 的提供者

[英]NullInjectorError: No provider for InjectionToken DEFAULT_LOCALE

我正在嘗試使用 i18n 設置 Angular 2 項目。 使用 Transloco 遵循 此處的教程,一切都很好。 但是,當我運行單元測試時,我得到了這個錯誤,我在網上找不到任何關於它的東西。 我明顯錯過了一些東西,但我不知道是什么。 任何幫助將非常感激。 這是我的 app.component.s ...

Transloco 翻譯第一次不起作用

[英]Transloco translate doesn't work the first time

這是我的 Transloco 配置: 當我嘗試使用 translate 方法進行翻譯時,它第一次不起作用。 如果我通過路由器移動到另一條路由並返回 go,則文本被翻譯。 似乎您第一次加載應用程序時沒有時間加載翻譯。 有沒有辦法來解決這個問題? 提前致謝。 ...


 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM