Get fuzzy matches from get_term_by

There’re several questions you should ask yourself:

#1) Are the “language codes” actually ISO 639-2 compatible?

Stephen Harris and me build a list of all available ISO 639-2 language codes – [available on GitHub on the WeCodeMore-Label account] – that should be used. This is the official list (build from the official ISO source). In case you’re using anything else, then there’s already no possibility as the codes are unreliable.

You could now just import that as Git-Submodule into your project, fetch it and compare against it.

#2) Are the strings similar?

You could use – for example – a Levenshtein comparison to check if the string is matching in various combinations that include misspelled combinations.

#3) Is it a sane way to do it?

No. Absolutely not. You should reconsider the way you’re doing things. Seems like you got a X-Y-Problem.