Skip to content

Fix: translation id makes a shortcode event swallow the following lines - #2802

Open
ajveach wants to merge 1 commit into
dialogic-godot:mainfrom
ajveach:fix/shortcode-translation-id-swallows-events
Open

Fix: translation id makes a shortcode event swallow the following lines#2802
ajveach wants to merge 1 commit into
dialogic-godot:mainfrom
ajveach:fix/shortcode-translation-id-swallows-events

Conversation

@ajveach

@ajveach ajveach commented Aug 12, 2026

Copy link
Copy Markdown

The problem

With translation enabled, any bracketed event that carries a translation id
silently absorbs the lines after it. Those lines never become events — they
just disappear at runtime, with no error and nothing visibly wrong in the
timeline text.

Reproduction

With translation/enabled on, a timeline saved as:

[text_input text="What is your name?" var="name"] #id:1
Some Character: First line.
Some Character: Second line.

parses to a single text_input event. Both text lines are gone.

If a later line does end with ], the swallowing stops there — and that
event is consumed as well, so a bracketed event following the affected one
is lost along with the lines between them.

Cause

DialogicEvent.is_string_full_event() treats a shortcode event as complete
only when the string ends with ']':

if get_shortcode() != 'default_shortcode': return string.strip_edges().ends_with(']')

but _store_as_string() appends the translation id after the closing
bracket:

return to_text() + ' #id:'+str(_translation_id)

So the event never reads as complete, and the collect loop in
DialogicTimeline.process()
while not event.is_string_full_event(event_content) — keeps appending
following lines into it until one ends with ']'.

Text events are unaffected, because they return true unconditionally. That
is why this only shows up once translation is enabled and ids begin to be
written onto bracketed events.

The fix

is_string_full_event() now strips a trailing #id: before testing for the
bracket, the same way _load_from_string() and _test_event_string()
already do for the same suffix.

The strip is gated on can_be_translated(), matching _store_as_string()
an id is only ever written under that condition, so no event that carries one
can be missed, and no event that lacks one changes behaviour.

is_string_full_event() treats a shortcode event as complete only when the
string ends with ']', but _store_as_string() appends the translation id
*after* the closing bracket. So a bracketed event carrying an id — for
example [text_input text="What is your name?" var="name"] #id:11 — never
reads as complete, and the collect loop in DialogicTimeline.process()
keeps appending the following lines into it until it reaches one that
does end with ']'.

Those lines are absorbed into the first event and never become events of
their own. At runtime this looks like dialogue and events silently going
missing, with no error and nothing wrong in the timeline text. Text
events are unaffected because they return true unconditionally, so it
only appears once translation is enabled and ids start being written
onto bracketed events.

is_string_full_event() now removes a trailing #id: before testing for the
bracket, the same way _load_from_string() and _test_event_string()
already do for the same suffix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant