Module talk:RecipeUsage

Translation subpages
This module shows recipes from translation subpages (i.e. "/fr" but not "satisfactory-de"). For example Concrete shows "Space Elevator/fr" and "Space Elevator/nl" in the table. Anyway I don't know how to fix it. ✏ A marshall (talk) 17:21, 4 April 2019 (UTC) ✏ A marshall (talk) 05:16, 5 April 2019 (UTC) ✏ A marshall (talk) 14:44, 5 April 2019 (UTC) ✏ A marshall (talk) 05:36, 6 April 2019 (UTC)
 * The data seems to come from Template:Infobox_crafting_section, so maybe it's possible to add a language parameter there? --CerbrusNL (talk) 17:31, 4 April 2019 (UTC)
 * Turns out it was relatively simple to filter out pages that have a / in their name. This at least covers the translations like /fr --CerbrusNL (talk) 22:28, 4 April 2019 (UTC)
 * Cool. I tested what the change did to a language subpage like Barre_de_fer. Both with and without the change it doesn't show Space_Elevator/fr which takes iron rods, but does show Fonderie. Ideally it would show up, but I suppose just having a translated title will fix it as well, plus it's not that important.
 * My thoughts exactly. Preferably, those /lang pages should be moved to a translated title, any way.
 * Looks like this page: Barre_de_fer got messed up, and some others too. I think it happened after you created some redirect pages, so maybe switching the "/fr" type pages to redirect to the translated name might fix it. Or maybe it has to do with the ingredients listed in the infobox, Fonderie lists the French names, but Space_Elevator/fr lists English ingredients.
 * Oh boy... I added those redirects because the automated recipes linked to non-existant pages. It might be better to move the /fr pages then. I'll see what I can do. --CerbrusNL (talk) 17:45, 5 April 2019 (UTC)
 * It looks like a Cache "Purge" solved the problem (The button is under "More" in the page's header). I've gone through the french pages, and cleared one more page. If you see any I've missed, let me know (Or purge, if you can) --CerbrusNL (talk) 17:52, 5 April 2019 (UTC)
 * Yeah I don't see any more language pages with that problem. Anyway back to the original problem again, Concrete shows "Space Elevator" twice (one from the /nl page), and also "Бур MK1". Perhaps it'd be possible to add a new parameter to Template:Infobox_crafting_section for language, and leave it blank for English pages, but fill it in for translation pages. Then do something similar to this line "local ingredient = mw.title.getCurrentTitle.text" to check if the page has a category with "translation" in it. If it doesn't, then filter out recipes that have a non-blank language parameter.
 * Hm, Poth pages contain essentially the same Infobox building. We could DISTINCT by name, to make sure we don't get duplicates... --CerbrusNL (talk) 07:56, 6 April 2019 (UTC)

Attempt at fixing the above issue
I tried to fix the thing with this code: https://satisfactory.gamepedia.com/index.php?title=Module:RecipeUsage&diff=11336&oldid=10135 It didn't work and I don't know Lua or programming in general well enough to troubleshoot it. But here are my thoughts for what the code was supposed to do.
 * If the page is not on satisfactory.gamepedia.com, then skip the added code. This is so the code will still work when a language gets moved to a seperate wiki.
 * If it is on satisfactory.gamepedia.com:
 * If the page is a translated subpage, like /zh or /nl:
 * the cargo.query is modified so that only recipes that match the language code will be found. It can also match english recipes, but that will only happen if ingredients in the infobox are left untranslated.
 * the ingedient variable is changed from the untranslated page title to the name of the infobox on the page (which is presumably translated). The pattern match I used will only match the first parameter of the first infobox, which should be the name, but might not be?).
 * if the page isn't a translated subpage:
 * the cargo.query is modified so that only recipes from pages without a "/" are included. This also means English subpages won't be included, which I suppose is good because those would only be testing pages. So testing pages would be able to get crafting recipes from all the main pages, but not vice versa.

This change would also have been accompanied by moving all language pages with a translated name to a "/**" page.

The error message I saw when I did the change was that "Page" couldn't be found in the table. Maybe the page has to be stored here: Template:Infobox_crafting_section, even though it shows up already here: cargo table "crafting_recipes". ✏ A marshall (talk) 00:15, 12 April 2019 (UTC) ✏ A marshall (talk) 04:33, 12 April 2019 (UTC)
 * Here's some pages to use when testing:
 * -Concrete: An English page that lists recipes from translated pages that use English ingredients. (Extra Space Elevator from Space Elevator/nl and Бур MK1 from Бур MK1).
 * -Iron Plate/ko: A translated subpage where lists nothing because pages like Reinforced_Iron_Plate/ko use translated ingredient names (as opposed to "Iron Plate/ko" or English ones).
 * -철_주괴: A page with a translated name that works just fine because Iron Rod/ko and Iron Plate/ko both use translated ingredients.
 * -Iron Plate: Lists an extra Conveyor Belt from Conveyor Belt/sandbox.