Skip to content

Commit

Permalink
Implement LocalazyCatalog::SetLanguage()
Browse files Browse the repository at this point in the history
  • Loading branch information
vslavik committed Sep 13, 2023
1 parent 4ffc5e7 commit e16e0d7
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/catalog_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,13 @@ class LocalazyCatalog : public JSONCatalog
return doc.value("generator", "") == "Localazy";
}

bool HasCapability(Catalog::Cap cap) const override
{
if (cap == Cap::LanguageSetting)
return true;
return JSONCatalog::HasCapability(cap);
}

void Parse() override
{
m_header.SetHeader("X-Generator", m_doc.value("generator", ""));
Expand All @@ -436,6 +443,12 @@ class LocalazyCatalog : public JSONCatalog
}
}

void SetLanguage(Language lang) override
{
JSONCatalog::SetLanguage(lang);
m_doc["targetLocale"] = lang.LanguageTag();
}

protected:
class Item : public JSONCatalogItem
{
Expand Down

0 comments on commit e16e0d7

Please sign in to comment.