tl;dr: We provide elm-intl with fallback language rules and mark generated translations as fallbacks (if they are not available in the actual language). Otherwise elm-intl fails, telling the user which translations are missing. Fallback translations are excluded when running elm-intl generate-json.
If you have a complete set of translations, I would say you just add some translations/<new_locale>.json and run elm-intl generate-elm.
What about incomplete sets? So, say you donāt have German (de) translations for everything. Then elm-intl generate-elm should fail (telling you what the missing translations were) unless you say what the fallback language for de will be. So, you somehow give elm-intl the information that de has en as fallback and then it will use the translations from translations/en.json for the ones which are missing in translations/de.json but marking them as fallbacks. This could look something like this:
module Translations.De exposing (..)
import Localized exposing (Text, s, fallback)
greeting : Text args msg
greeting =
s "Good morning!"
|> fallback
So we mark on the type level that these translations are just fallbacks (which does not change the way they are printed) and can exclude them when running elm-intl generate-json. This way we make sure that after generating the jsons we donāt end up with ācompleteā languages which are actually just filled with fallback translations.
There could also be a āstricterā version of print which breaks compilation when called with a fallback translation. So if you want to check that you have properly translated everything before releasing you just change your imports of Localized. (But I think that would require that Text has a third type variable, so we have s "foo" : Text Final args msg but s "foo" |> fallback : Text scope args msg) Maybe there are other ways to let the compiler tell us we are using fallback translations?
tl;dr: Using some versioning system (like git) could already solve most of the update/conversion issues, but I am not sure!
What about updating translations? Say you have generated your Elm code before and updated your json-files. If you run elm-intl generate-elm again, it will just overwrite your translations modules. This maybe seem bad, but if you checked these modules in via git, you can actually very easily get the changes with git diff src/Translations/De.elm for example. And then you can also use git to only apply the changes you find good and drop (or adjust) the other ones. This would also work the other way: if you made changes to src/Translations/De.elm and ran elm-intl generate-json, git will tell you what has changed in the translations/de.json and you can only stage part of them if you like.
You would only run into trouble, if you made changes to the Elm-files and ran elm-intl generate-elm before staging or commiting these. (And of course, if you edit the jsons without commiting or staging and run elm-intl generate-json).
Or am I missing some other problems here? And would this actually be enough to deal with the updating/conversion use case?
Another way would be, that elm-intl tells the user which parts of the translation modules it will overwrite and ask if it should do so. (And there could be a --yes option to just overwrite everything per default, so you get the behaviour from above.)