Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Author usernames should not be translatable #90

Open
its-miroma opened this issue Apr 22, 2024 · 3 comments
Open

Author usernames should not be translatable #90

its-miroma opened this issue Apr 22, 2024 · 3 comments
Labels
bug Something on the website doesn't work.

Comments

@its-miroma
Copy link
Contributor

Usernames of authors are currently translatable in Crowdin.

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

@IMB11
Copy link
Member

IMB11 commented Apr 22, 2024

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 IMB11 closed this as not planned Won't fix, can't repro, duplicate, stale Apr 22, 2024
@its-miroma
Copy link
Contributor Author

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)

@IMB11
Copy link
Member

IMB11 commented Apr 23, 2024

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

@IMB11 IMB11 reopened this Jun 9, 2024
@IMB11 IMB11 added the bug Something on the website doesn't work. label Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something on the website doesn't work.
Projects
None yet
Development

No branches or pull requests

2 participants