i18next is the library Stonehearth uses for localization, in case its documentation is helpful. Adding full support for declension is probably a significant amount of work, but the idea is that you would modify localizeEntityName to take a second argument specifying the grammatical case of the context when detecting name(), then have some heuristics for how to inflect words that match specific patterns. The latter would be pure JS string processing, that doesn’t care about any existing code.
Sometimes you can rephrase things in a way that doesn’t require declension, though it can sound less natural. E.g.: "chasing [name(data.target)]" would naturally translate to "в погоне за [name(data.target)]" but could also be phrased as "в погоне. Цель: [name(data.target)]".