There was a problem editing text with %

We have a problem editing texts with the % sign.

Texts with this sign inside cannot be changed. After saving, the text disappears and is not displayed on the site.

Please help solve the problem.

Text example:
44

1 Like

The % when used inside href= is an escape character to display a charater using a number value. So %{ is not % followed by a number.

try changing the % to %25

See: Pass a percent (%) sign in a url and get exact value of it using php

3 Likes

Thanks! But the problem is not solved this way. In this case, it turns out to save the changes, but unfortunately the link does not work…

1 Like

What are you trying to accomplish? Do you want to change the value of the link’s href?

1 Like

@Simon_Cossar No, we need to edit some texts on the site, but we cannot do this. Texts with % inside cannot be changed. After saving, the text disappears and it is not displayed on the site.

For example, we cannot change this text:

But, when we delete % from this text, changes are saved perfectly.

1 Like

@Simon_Cossar Уou can watch the video Dropbox - IMG_3663.MOV - Simplify your life

3 Likes

The first part of that text (## [Welcome to %{title}](#welcome)) is markdown that creates an h2 element with a link. The link’s href is set to “#welcome”. The %{title} tag is a placeholder that is used by Discourse to substitute your site’s title into the text.

It should be possible to customize this text, but you need to be sure you are using valid markdown. For example, this works:

## [Welcome to My Demo Site](#welcome)
An account is required. Please create an account or log in to continue.

This also works, it removes the link from the h2 element:

## Welcome to My Demo Site
An account is required. Please create an account or log in to continue.
4 Likes

@Simon_Cossar Yes, I know about this possibility, thanks. But we need to translate several hundred texts and this is a big problem :grinning:

1 Like

Thanks for posting the video. I’m finding a similar issue on my development site.

Clicking the edit button for either of the blank entries shows an empty textarea.

Clicking the Revert Changes button reverts back to the default text, but only the first line of text is displayed in the textarea.

After refreshing the page, the full default text content is displayed.

1 Like

Yes, thanks, I know how to return the original text, but I need to make changes to it and cannot do that…

1 Like

Probably related:

3 Likes

Thanks for your post. But the problem is not in returning the original text, but in making changes to it. Please watch my video above.

1 Like

I’ve moved this topic to the #bug category. What I’m finding on my hosted Discourse site is that when text content that includes a placeholder is edited, the edited text is saved to the TranslationOverride table. The text is displayed in the site’s UI. For example, if I edit the login_required.welcome_message text, my edited text is used on the login page.

The issue is that the edited text is not consistently displayed in the Admiin / Customize / Text list, and is not displayed at all on the text edit page:

If I check the ‘Only show overridden’ checkbox, or search for a specific translation key, the edited text is displayed:

If I click the text’s edit button, an empty text area is displayed:

Edit: this seems to be a duplicate of the issue @tshenry linked to: Changing systems welcome message. The difference I’m finding is that clicking the revert button in step 6 reverts to the default text, not the recently edited text. The problem only seems to happen in strings that have placeholders. I’ll close this as a duplicate topic for now.

3 Likes