On a multilingual site, I can have, say, index.md, index.en.md, and mydata.json in the same page leaf (English is not the primary language here). It works as expected: the data from JSON can be used in both languages (.Resources.GetMatch, then unmarshal).
However, if I remove index.md (i.e. there’s no page for default language in the bundle), .Resources.GetMatch gets nil for the other language, even though the actual resource file is there.
Looks like a bug to me. 0.122.0 works as expected (i.e. does not require default language to be present in the bundle for .Resources.GetMatch in other languages to work).
This is expected. The resource, without a language identifier, is associated with the default content language. Since you don’t publish the page in the default content language, the resource is not published.
If you only have index.en.md, rename the resource to mydata.en.json.
There are a couple of related issues/proposals, which will probably not be addressed:
The same goes for images. And image.jpg is NOT a wild card. Without a lang identifier, it is tied to the default content language in the same way that index.md is tied to the default content language.
To summarize, if a resource is not language specific it is tied to the default content language, and if content in the default content language is not published, neither will the resource, so it cannot be “shared”.
Translation tables are obviously a bit different, because they are independent of content.
Yes, I’ve read that. I understand how it works. What I’m saying is that it’s the whole logic that’s broken here.
“No string in the language → fallback to default language → fallback to empty”, that’s how the multilingual Hugo works.
“No resource in the language → well, no resource it is”, that’s what 0.123 is doing in this case. Yes, there’s no page in default language, but the resource is there, it is provided, it is explicitly called.