Unwanted single-letter conjunctions and numbers at the end of the line

In Polish, we have a typesetting rule that single-letter conjunctions should not be left alone at the end of the line. The same applies in general to numbers (unless, of course, they are followed by a full stop). Therefore, a non-breaking space is used in such cases. However, the non-breaking space has a fixed width and it looks bad in justified text, so auto-inserting them is not the best option and the text must be visually checked for such cases. According to information from Claude AI, it’s not possible to create a Python script that would do exactly that as it’s only the text editing application that knows where the end of the text line is. Is there some workaround for this?

JFTR:
tdf#143380 (Polish language: Avoid putting conjunctions like “i” “a” “o” at the end of a line).

Release Notes 24.2:

There are other space characters with no-break property in Unicode. You could try U+202F NARROW NO-BREAK SPACE.

You can easily insert it with Insert>Formatting Mark>Narrow No-break Space or Alt+Shift+Space. If under MacOS, check keyboard shortcut.

PS: when asking here, always mention OS name, exact LO version and save format (the latter is very important as most suggestions are only valid and stable for .odt).

EDIT: the post mentioned below by @PanTulipan is

You inspired me to look further and I found your post in a topic on the (non-existing) variable-width non-breaking space - the solution is to insert word joiners between the prepositions/numbers and ordinary spaces. Thank you!