Files
PrayerTracker/src/PrayerTracker.UI/I18N.fs
Daniel J. Summers dd5f32e320 v8.1 (#47)
- Update to .NET 7
- Update database access to use data source vs. connection
- Allow e-mail server address to be configurable
- Support Docker hosting
2023-07-04 20:03:43 -04:00

23 lines
801 B
Forth

/// Internationalization for PrayerTracker
module PrayerTracker.Views.I18N
open Microsoft.AspNetCore.Mvc.Localization
open Microsoft.Extensions.Localization
open PrayerTracker
let mutable private stringLocFactory : IStringLocalizerFactory = null
let mutable private htmlLocFactory : IHtmlLocalizerFactory = null
let private resAsmName = typeof<Common>.Assembly.GetName().Name
/// Set up the string and HTML localizer factories
let setUpFactories fac =
stringLocFactory <- fac
htmlLocFactory <- HtmlLocalizerFactory stringLocFactory
/// An instance of the common string localizer
let localizer = lazy (stringLocFactory.Create ("Common", resAsmName))
/// Get a view localizer
let forView (view : string) =
htmlLocFactory.Create ($"Views.{view.Replace ('/', '.')}", resAsmName)