@@ -659,102 +659,5 @@ function create_adv_settings_dlg()
659
659
return dlg
660
660
end
661
661
662
- local function create_minetest_conf_example ()
663
- local result = " # This file contains a list of all available settings and their default value for minetest.conf\n " ..
664
- " \n " ..
665
- " # By default, all the settings are commented and not functional.\n " ..
666
- " # Uncomment settings by removing the preceding #.\n " ..
667
- " \n " ..
668
- " # minetest.conf is read by default from:\n " ..
669
- " # ../minetest.conf\n " ..
670
- " # ../../minetest.conf\n " ..
671
- " # Any other path can be chosen by passing the path as a parameter\n " ..
672
- " # to the program, eg. \" minetest.exe --config ../minetest.conf.example\" .\n " ..
673
- " \n " ..
674
- " # Further documentation:\n " ..
675
- " # http://wiki.minetest.net/\n " ..
676
- " \n "
677
-
678
- local settings = parse_config_file (true , false )
679
- for _ , entry in ipairs (settings ) do
680
- if entry .type == " category" then
681
- if entry .level == 0 then
682
- result = result .. " #\n # " .. entry .name .. " \n #\n\n "
683
- else
684
- for i = 1 , entry .level do
685
- result = result .. " #"
686
- end
687
- result = result .. " # " .. entry .name .. " \n\n "
688
- end
689
- else
690
- if entry .comment ~= " " then
691
- for _ , comment_line in ipairs (entry .comment :split (" \n " , true )) do
692
- result = result .. " # " .. comment_line .. " \n "
693
- end
694
- end
695
- result = result .. " # type: " .. entry .type
696
- if entry .min then
697
- result = result .. " min: " .. entry .min
698
- end
699
- if entry .max then
700
- result = result .. " max: " .. entry .max
701
- end
702
- if entry .values then
703
- result = result .. " values: " .. table.concat (entry .values , " , " )
704
- end
705
- if entry .possible then
706
- result = result .. " possible values: " .. entry .possible :gsub (" ," , " , " )
707
- end
708
- result = result .. " \n "
709
- local append = " "
710
- if entry .default ~= " " then
711
- append = " " .. entry .default
712
- end
713
- result = result .. " # " .. entry .name .. " =" .. append .. " \n\n "
714
- end
715
- end
716
- return result
717
- end
718
-
719
- local function create_translation_file ()
720
- local result = " // This file is automatically generated\n " ..
721
- " // It conatins a bunch of fake gettext calls, to tell xgettext about the strings in config files\n " ..
722
- " // To update it, refer to the bottom of builtin/mainmenu/tab_settings.lua\n\n " ..
723
- " fake_function() {\n "
724
-
725
- local settings = parse_config_file (true , false )
726
- for _ , entry in ipairs (settings ) do
727
- if entry .type == " category" then
728
- local name_escaped = entry .name :gsub (" \" " , " \\\" " )
729
- result = result .. " \t gettext(\" " .. name_escaped .. " \" );\n "
730
- else
731
- if entry .readable_name then
732
- local readable_name_escaped = entry .readable_name :gsub (" \" " , " \\\" " )
733
- result = result .. " \t gettext(\" " .. readable_name_escaped .. " \" );\n "
734
- end
735
- if entry .comment ~= " " then
736
- local comment_escaped = entry .comment :gsub (" \n " , " \\ n" )
737
- comment_escaped = comment_escaped :gsub (" \" " , " \\\" " )
738
- result = result .. " \t gettext(\" " .. comment_escaped .. " \" );\n "
739
- end
740
- end
741
- end
742
- result = result .. " }\n "
743
- return result
744
- end
745
-
746
- if false then
747
- local file = io.open (" minetest.conf.example" , " w" )
748
- if file then
749
- file :write (create_minetest_conf_example ())
750
- file :close ()
751
- end
752
- end
753
-
754
- if false then
755
- local file = io.open (" src/settings_translation_file.cpp" , " w" )
756
- if file then
757
- file :write (create_translation_file ())
758
- file :close ()
759
- end
760
- end
662
+ -- generate minetest.conf.example and settings_translation_file.cpp:
663
+ -- assert(loadfile(core.get_mainmenu_path()..DIR_DELIM.."generate_from_settingtypes.lua"))(parse_config_file(true, false))
0 commit comments