Opened on 10/03/2016 at 06:43:43 PM
Closed on 07/20/2017 at 10:26:12 AM
#4489 closed change (rejected)
Shorten <fix> translation string variable syntax in CMS
Reported by: | juliandoucette | Assignee: | |
---|---|---|---|
Priority: | Unknown | Milestone: | |
Module: | Sitescripts | Keywords: | |
Cc: | kvas, fhd, saroyanm, trev, lisabielik | Blocked By: | |
Blocking: | Platform: | Unknown / Cross platform | |
Ready: | no | Confidential: | no |
Tester: | Unknown | Verified working: | no |
Review URL(s): |
Description (last modified by juliandoucette)
Background
We surround all brand names and numbers within translated strings in our CMS with <fix> tags so that they appear as variables within crowdin.
Although this is effective, it is inconvenient because:
- It requires HTML syntax inside of Markdown
- It is awkward to type repetitively
What to change
Support an alternative <fix> format.
Suggestions
=fixed= -fixed- {fixed}
Attachments (0)
Change History (18)
comment:3 Changed on 10/04/2016 at 11:31:57 AM by trev
comment:4 Changed on 10/04/2016 at 11:52:09 AM by juliandoucette
I just verified that Markdown module for Python produces <code> tags for backticks. Anything else would be very surprising as <pre> is a block-level tag and should never be placed within a paragraph.
Verified. I was wrong about this :/ .
Now I'm not sure what your first suggestion is about. Should we wrap brand names in <code> tags? Or should the CMS strip <code> tags? If the latter, what should we use when talking about filters or URLs on https://adblockplus.org/en/filters?
No. I was suggesting we override Markdown's conversion of backticks to pre tags. This was an invalid suggestion.
What for example? My keyboard doesn't have too many non-shift characters other than letters, it's only <,.-#+. I can only imagine using # here, and that one requires pressing Shift on US keyboards. Note also how Markdown already claimed all usable non-shift characters on US keyboards.
Good question.
A few suggestions:
non-shift
[fixed] =fixed= -fixed-
shift
{fixed}
comment:6 Changed on 10/04/2016 at 12:07:10 PM by trev
=fixed=
If I were to choose, I would probably go with this one even though it is non-shift on German keyboards - the equals sign makes this somewhat easier to remember.
comment:7 follow-up: ↓ 9 Changed on 10/06/2016 at 09:44:24 AM by kvas
Do I get it right that everybody would be happy with the =fixed string= format? From my side it looks fine. Perhaps we could write it into the test of the issue.
Can we also specify the list of characters that can be present inside of the fixed string? This would be needed to robustly replace them inside of markdown and HTML. I suppose it's alphanumeric characters, spaces, dashes, underscores, ., ,, ?, !, maybe parentheses... What else?
comment:8 Changed on 10/06/2016 at 09:45:50 AM by fhd
My thoughts:
[fixed] - I don't think we should use square brackets, Markdown already uses those for links.
=fixed= - Like Wladimir said, this makes some degree of sense since the string will stay the same (i.e. equal) in all languages.
-fixed- - This is used for strikethrough in Textile, so I personally find that confusing. YMMV.
{fixed} - We use {{ for our translation syntax and Jinja uses {%, so this could be confusing for some people. On the other hand, Java's MessageFormat uses { for parameters, and since I did my fair share of Java, to me it would actually be somewhat obvious and not confusing at all.
Long story short: It's = or { for me.
comment:9 in reply to: ↑ 7 ; follow-up: ↓ 11 Changed on 10/06/2016 at 09:50:14 AM by trev
Replying to kvas:
Can we also specify the list of characters that can be present inside of the fixed string? This would be needed to robustly replace them inside of markdown and HTML. I suppose it's alphanumeric characters, spaces, dashes, underscores, ., ,, ?, !, maybe parentheses... What else?
Why do we want to limit ourselves? Isn't it sufficient that the starting = is preceded by a space character and followed by a non-space, and for the ending = it's the other way around? This should be consistent with treatment of inline formatting in Markdown. Note that fixed strings can contain HTML tags.
comment:10 Changed on 10/06/2016 at 09:52:15 AM by juliandoucette
I agree with fhd, except:
- I wonder if escaping = inside of =fixed= would be annoying/confusing
- I like {fixed} even though it's a shift character because crowdin formats variables similarly
comment:11 in reply to: ↑ 9 Changed on 10/10/2016 at 09:03:23 AM by kvas
Replying to trev:
Why do we want to limit ourselves? Isn't it sufficient that the starting = is preceded by a space character and followed by a non-space, and for the ending = it's the other way around? This should be consistent with treatment of inline formatting in Markdown. Note that fixed strings can contain HTML tags.
Yes, seems like it would work. And in case we have an = sign with space on on side and no space on the other that is not a fixed string marker, we can always escape it using HTML entities (= or =).
BTW, if a fixed string contains HTML tags, do opening and closing tags inside of it have to be balanced?
Replying to juliandoucette:
I wonder if escaping = inside of =fixed= would be annoying/confusing
We would only need to escape = that has a space on one side and no space on the other side. This seems to be rather uncommon in normal text. And things like foo = bar or foo=bar would just go through unchanged.
I like {fixed} even though it's a shift character because crowdin formats variables similarly
I find it somewhat confusing, since it's similar to many other constructions (ours and Jinja's) but if it seems convenient to you, perhaps that's more important, since you're using the CMS much more.
comment:12 Changed on 10/10/2016 at 09:12:24 AM by trev
BTW, if a fixed string contains HTML tags, do opening and closing tags inside of it have to be balanced?
It has to be valid HTML code by itself - we will feed it to an HTML parser. But we don't really enforce anything there, nor do I see why we should.
comment:13 Changed on 10/10/2016 at 01:43:47 PM by juliandoucette
- Cc lisabielik added
- Description modified (diff)
comment:14 follow-up: ↓ 15 Changed on 10/10/2016 at 01:47:22 PM by juliandoucette
I find it somewhat confusing, since it's similar to many other constructions (ours and Jinja's) but if it seems convenient to you, perhaps that's more important, since you're using the CMS much more.
We should confirm with @saroyanm and @lisabielik.
comment:15 in reply to: ↑ 14 Changed on 10/11/2016 at 03:01:31 PM by lisabielik
Replying to juliandoucette:
I find it somewhat confusing, since it's similar to many other constructions (ours and Jinja's) but if it seems convenient to you, perhaps that's more important, since you're using the CMS much more.
We should confirm with @saroyanm and @lisabielik.
I don't have a preference. Whatever works for the majority is fine with me.
comment:16 follow-up: ↓ 17 Changed on 07/18/2017 at 01:34:49 PM by juliandoucette
I think #5340 makes this irrelevant.
comment:17 in reply to: ↑ 16 Changed on 07/20/2017 at 10:15:22 AM by kvas
Replying to juliandoucette:
I think #5340 makes this irrelevant.
Yes, you're probably right. Shall we close it then, or wait until #5340 is implemented?
comment:18 Changed on 07/20/2017 at 10:26:12 AM by juliandoucette
- Resolution set to rejected
- Status changed from new to closed
Yep.
I just verified that Markdown module for Python produces <code> tags for backticks. Anything else would be very surprising as <pre> is a block-level tag and should never be placed within a paragraph.
Now I'm not sure what your first suggestion is about. Should we wrap brand names in <code> tags? Or should the CMS strip <code> tags? If the latter, what should we use when talking about filters or URLs on https://adblockplus.org/en/filters?
What for example? My keyboard doesn't have too many non-shift characters other than letters, it's only <,.-#+. I can only imagine using # here, and that one requires pressing Shift on US keyboards. Note also how Markdown already claimed all usable non-shift characters on US keyboards.