I sometimes do this with an ACF options page which can then be translated with WPML, with text fields for each string, pulled into templates using the from=options attribute like <Field string_author_prefix from=options />
I’ve also done it for simpler sites with the WordPress user locale meta, though WPML doesn’t really interact with this meta unfortunately:
You should check how WPML saves the laguage. In Polylang I can call a taxonomy called language with L&L and get the current language. Maybe WPML uses the same approach.
If thats the case, you can set a variable with the value from the taxonomy an use switch (See Julias post) to build the labels. At least with Polylang this works like a charm.
And a check for the path (like you suggested) can be used as fallback for the rare case you load something before the language is defined from WPML. (I had one case with DIVI where this was neccessary)