fabric-docs icon indicating copy to clipboard operation
fabric-docs copied to clipboard

Author usernames should not be translatable

Open its-miroma opened this issue 1 year ago • 4 comments

Usernames of authors are currently translatable in Crowdin.

Example: https://github.com/FabricMC/fabric-docs/blob/2355c30a9bd52729842cd3e4ee1b79b4ca717efe/develop/events.md?plain=1#L4-L15


Important context on Discord

https://discord.com/channels/507304429255393322/1208846408552030238/1344312163141025843

its-miroma avatar Apr 22 '24 12:04 its-miroma

Not really much we can do about this, as we can't disable the translation of yml frontmatter without disabling the ability to translate the page title and description.

IMB11 avatar Apr 22 '24 13:04 IMB11

I'm not super familiar with Crowdin's configuration, but if I understand correctly you can add custom rules to ignore some sections in files. See https://support.crowdin.com/custom-segmentation

After experimenting on https://regex101.com, I think this may work:

<rule break="yes">
	<beforebreak>\A---\n(?:(?!---\n).*\n)*?authors:\n</beforebreak>
	<afterbreak> *+(?!- )</afterbreak>
</rule>
/regex/ explanation

These regexes rely on lookarounds, which Crowdin should support.

beforebreak

  • \A: assert position at the beginning of the string (aka file)
  • ---\n: make sure we're inside of the frontmatter
  • (?:(?!---\n).*\n)*?: match all lines before authors: in the frontmatter
    • (?:...)*?: match zero or more lines lazily, to stop when reaching authors: below
    • (?!---\n): a negative lookahead to make sure we're still in the frontmatter. If this matches, then the file does not mention any authors
    • .*\n: match zero or more characters followed by a newline
  • authors:\n: match the authors: line
  • the break starts here

afterbreak

  • the break ends if this matches
  • *+: match zero or more spaces greedily (aka ignore indentation)
    • I'm pretty sure that YAML only supports spaces, but if that's not the case you can substitute this with [ \t]*+ to also match tabs
  • (?!- ): negative lookahead for - (aka make sure there are no more authors)

its-miroma avatar Apr 22 '24 21:04 its-miroma

This is only for manual XML/HTML based uploads, we use a different system to upload translations that doesn't support segments.

IMB11 avatar Apr 23 '24 05:04 IMB11

Check this out: https://github.com/FabricMC/fabric-docs/blob/07fb3816100ef588e074e60d661db1ffbc24f5cc/translated/pl_pl/develop/blocks/block-entities.md?plain=1#L5 It's unclear for Crowdin translators whether they should add their usernames to authors

its-miroma avatar Mar 21 '25 18:03 its-miroma