I have created a docker container with github DOT com/Overv/openstreetmap-tile-server and have added 3 regions from https://download.geofabrik.de as a merged pbf file.
Overv/openstreetmap-tile-server uses the OpenStreetMap Carto raster map style which doesn’t have an easy way to change the language of labels. You could do it but it would require changing the code to prefer name:gd over name in quite a few different places as explained here:
You might have a better time with a vector tile setup. Their flexibility can make switching between languages easier. For example here are a couple of vectir maps that can show labels in Scotts Gaelic (you need to pick it from the language menu on the second one as I can’t link directly to it):
That said, the same lua code could be used for for both raster and vector tiles. In my case this is here.
One question you will want to ask yourself - where there is no name:gd, what name do you want to show? You might have a genuine reason to show no name at all (mapio.cymru does this), or you might want to show a name that is closer - I chose to show Irish, then Welsh, then English in the absence of Scots Gaelic.
Apologies for OT but, I’d assumed “the code” here meant the lua import script :) . I don’t even think that osm2pgsql (for raster) or any equivalent for vector even does special-case name as a tag.
For raster “osm2pgsql” uses a file (confusingly called a “style file”) which determines which keys it should be interested in. This is different to the lua code (often called “style.lua”) which runs per data item in the imported data.
For vector “tilemaker” (just one of the options for creating vector tiles, but arguably the most approachable one) also uses lua code.
All I meant was that there isn’t some simple settings like an environment variable or similar where one can specify the language you want labels to use. You have to make some deeper level changes regardless of where exactly those are in “the code” (meant in a general sense as whatever part the overall code base it is necessary to change).