我有纯管道TranslatePipe,使用LocaleService具有locale$: Observable<string>当前区域设置的短语进行翻译.我也ChangeDetectionStrategy.OnPush启用了所有组件,包括AppComponent.现在,当有人更改语言时,如何重新加载整个应用程序?(在locale$observable中发出新值).
目前,我location.reload()在用户在语言之间切换后使用.这很烦人,因为整个页面都重新加载.如何使用纯管道和OnPush检测策略进行这种角度方式?
我希望能够通过在 launchSettings.json 中指定 Docker 配置文件来调试 Visual Studio 中的 docker 容器。但是,launchSettings.json 仅提供设置 httpPort 和 httpsPort 的选项(它们是从 80 和 443 到容器外部自定义端口的映射)。
我有一个 TCP 服务器应用程序 (TCPListener),它侦听自定义端口(比方说,9999)。我想在调试期间将该端口公开到容器外部。我可以以某种方式做到这一点(通过编辑 launchSettings.json 或其他一些配置)还是我只能单独运行 Docker 映像并以某种方式附加到它?
我有一个单独的LocalizationModule包含LocaleService它的defaultLanguage依赖项:
import { Injectable } from '@angular/core';
@Injectable()
export class LocaleService {
constructor(defaultLanguage: string) {
...
}
...
}
Run Code Online (Sandbox Code Playgroud)
所以现在我必须提供工厂来在注入器尝试解决它时创建此依赖项:
let localeServiceFactory = () => {
return new LocaleService('en-US');
};
export let localeServiceProvider = {
provide: LocaleService,
useFactory: localeServiceFactory
};
Run Code Online (Sandbox Code Playgroud)
我在我的LocalizationModule:
import { NgModule } from '@angular/core';
@NgModule({
providers: [
i18nServiceProvider
]
})
export class LocalizationModule { }
Run Code Online (Sandbox Code Playgroud)
这被捆绑为一个库并打包到 npm 注册表中。现在我想在我的许多应用程序中使用这个模块,但我必须能够配置默认语言。如何使用我自己的提供程序覆盖 i18nServiceProvider?
I have a list of physics parameters (like Pressure, Voltage and etc.) accessible to all users from all tenants (multi-tenant application). Now, I need a way to display appropriate language to different users.
Parameter is an aggregate root:
class Parameter
{
public string Name { get; }
public string Description { get; }
}
Run Code Online (Sandbox Code Playgroud)
I need a way to localize both name and description. My first approach was this:
class Parameter
{
public IDictionary<Locale, NameAndDescription> Info { get; }
} …Run Code Online (Sandbox Code Playgroud)