nixos/i18n: support "all" for extraLocales (#403567)

authored by Doron Behar and committed by GitHub 01e6f137 972da783

+14 -5
+14 -5
nixos/modules/config/i18n.nix
··· 6 }: 7 let 8 aggregatedLocales = 9 - builtins.map 10 (l: (lib.replaceStrings [ "utf8" "utf-8" "UTF8" ] [ "UTF-8" "UTF-8" "UTF-8" ] l) + "/UTF-8") 11 ( 12 [ config.i18n.defaultLocale ] 13 - ++ config.i18n.extraLocales 14 ++ (lib.attrValues (lib.filterAttrs (n: v: n != "LANGUAGE") config.i18n.extraLocaleSettings)) 15 - ); 16 in 17 { 18 ###### interface ··· 53 }; 54 55 extraLocales = lib.mkOption { 56 - type = lib.types.listOf lib.types.str; 57 default = [ ]; 58 example = [ "nl_NL.UTF-8" ]; 59 description = '' 60 Additional locales that the system should support, besides the ones 61 configured with {option}`i18n.defaultLocale` and 62 {option}`i18n.extraLocaleSettings`. 63 ''; 64 }; 65 ··· 108 109 config = { 110 warnings = 111 - lib.optional ((lib.subtractLists config.i18n.supportedLocales aggregatedLocales) != [ ]) 112 '' 113 `i18n.supportedLocales` is deprecated in favor of `i18n.extraLocales`, 114 and it seems you are using `i18n.supportedLocales` and forgot to
··· 6 }: 7 let 8 aggregatedLocales = 9 + (builtins.map 10 (l: (lib.replaceStrings [ "utf8" "utf-8" "UTF8" ] [ "UTF-8" "UTF-8" "UTF-8" ] l) + "/UTF-8") 11 ( 12 [ config.i18n.defaultLocale ] 13 + ++ (lib.optionals (builtins.isList config.i18n.extraLocales) config.i18n.extraLocales) 14 ++ (lib.attrValues (lib.filterAttrs (n: v: n != "LANGUAGE") config.i18n.extraLocaleSettings)) 15 + ) 16 + ) 17 + ++ (lib.optional (builtins.isString config.i18n.extraLocales) config.i18n.extraLocales); 18 in 19 { 20 ###### interface ··· 55 }; 56 57 extraLocales = lib.mkOption { 58 + type = lib.types.either (lib.types.listOf lib.types.str) (lib.types.enum [ "all" ]); 59 default = [ ]; 60 example = [ "nl_NL.UTF-8" ]; 61 description = '' 62 Additional locales that the system should support, besides the ones 63 configured with {option}`i18n.defaultLocale` and 64 {option}`i18n.extraLocaleSettings`. 65 + Set this to `"all"` to install all available locales. 66 ''; 67 }; 68 ··· 111 112 config = { 113 warnings = 114 + lib.optional 115 + ( 116 + !( 117 + (lib.subtractLists config.i18n.supportedLocales aggregatedLocales) == [ ] 118 + || lib.any (x: x == "all") config.i18n.supportedLocales 119 + ) 120 + ) 121 '' 122 `i18n.supportedLocales` is deprecated in favor of `i18n.extraLocales`, 123 and it seems you are using `i18n.supportedLocales` and forgot to