Skip to content

Commit c2adfae

Browse files
committed
Recognize Shopify-style en.default.json for sideloading
Offer to load en.default.json (as well as default.json or default.po while we're at it) when opening files with symbolic IDs for source text, in addition to previously used en.json. This naming convention is used by Shopify, see https://shopify.dev/docs/storefronts/themes/architecture/locales/storefront-locale-files
1 parent 39f771d commit c2adfae

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/edframe.cpp

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2419,10 +2419,20 @@ void PoeditFrame::OfferSideloadingSourceText()
24192419
return;
24202420

24212421
wxFileName fn(filename);
2422+
wxFileName ref;
24222423

2423-
wildcard.Replace("*", "en");
2424-
wxFileName ref(wildcard);
2425-
if (!ref.FileExists() || fn == ref)
2424+
for (auto candidate: {"en", "en.default", "default"})
2425+
{
2426+
auto w(wildcard);
2427+
w.Replace("*", candidate);
2428+
wxFileName fnw(w);
2429+
if (fnw.FileExists() && fnw != fn)
2430+
{
2431+
ref = fnw;
2432+
break;
2433+
}
2434+
}
2435+
if (!ref.IsOk())
24262436
return;
24272437

24282438
wxFileName displayRef(ref);

0 commit comments

Comments
 (0)