Skip to content

Instantly share code, notes, and snippets.

View TWith2Sugars's full-sized avatar
👨‍💻

Tony Williams TWith2Sugars

👨‍💻
View GitHub Profile
@kerams
kerams / 1.md
Last active January 1, 2022 15:50
Lazy loading of localization texts in Fable

Lazy loading of localization texts in Fable

Fable 3, Elmish, .NET 5, React, Webpack 5, npm. Demo code at https://github.com/kerams/fable-lazy-load-localization-sample.

At some point during the lifetime of your Fable application you may decide you need to support more than one language (in this post I am concerned with UI texts only, not data that is sent from the server) as well as the ability to switch the desired language on the fly. Let's say you have to support several languages with a ton of text each. Including them in your main application file/bundle will obviously make using them very straightforward and easy, but would prove incredibly wasteful. A single user will hardly use multiple languages, so having them download something they will never see or make use of does not make much sense.

While you could try using a full-fledged framework like react-i18next to handle all your localization needs, I'll detail the simplest means of getting parts of your UI localized tha

To enable parallel build for F# projects in Visual Studio 2013, add a string parameter named IsMultiThreadedBuildEnabled with value 1 into key HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\12.0_Config\Projects\{f2a71f9b-5d33-465a-a702-920d77279786}

(replace 12.0_Config with 14.0_Config for VS 2015)

Note: At some point this setting may disappear, it seems Visual Studio may erase it. So, you should check whether it's there before run VS.