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

Add fr_fr.json and es_es.json. Configure Git to manage line endings #25

Open
wants to merge 5 commits into
base: 1.20.1-forge
Choose a base branch
from

Conversation

kkempfer
Copy link

@kkempfer kkempfer commented Mar 24, 2024

Following your call on Curseforge and Modrinth, I added a translation of your mod in French and Spanish. Similar to @AsseyGithub, @avirtual777, @BesrezenUs, I only updated the default branch 1.20.1-forge.

I noticed some formatting issues in the different JSON files. If you want, I can format them all for you.

@kkempfer kkempfer changed the title Add fr_fr.json Add fr_fr.json and es_es.json Mar 24, 2024
@a0a7
Copy link
Member

a0a7 commented Mar 24, 2024

Yessssiiiir thank you so much! Really really appreciated. I will go ahead and pull this into all branches,

What are the formatting issues you've identified? If you want to fix it that would be awesome, but only do so if you're willing!

@kkempfer
Copy link
Author

kkempfer commented Mar 25, 2024

Git configuration: Line endings

Your git repo is not configured to handle Windows-style line endings. Some developers may use Windows OS. Without a proper configuration, this could break your code in the long run.

GitHub Doc: https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
More info: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/

I detected the problem in the first place by using this command to find all the files in your repo containing the Windows-style line endings patterns. There was only one file concerned, zh_cn.json, so no big deal since it's only a JSON file.

$ find -type f -exec grep -c --color=never $'\r' {} + | grep -v ":0"
...
./src/main/resources/assets/bellsandwhistles/lang/zh_cn.json:40
...
$ cat -e ./src/main/resources/assets/bellsandwhistles/lang/zh_cn.json | head -n 2
{^M$
    "block.bellsandwhistles.andesite_grab_rails": "M-eM-.M-^IM-eM-1M-1M-fM-^IM-6M-fM-^IM-^KM-fM-^]M-^F",^M$

I filtered out the binary files we do not want to modify (PNG, PDN and WEBP) and adjusted the .gitattributes file accordingly. Then, I ran the commands below to automatically fix and updates all the files.

$ git add --renormalize .
$ git rm -rf --cached .
$ git reset --hard HEAD
$ git commit -m "Normalize all the line endings"
$ git push

Now, your git repo is properly configured for any developer using any OS, independently of their local git configuration.

Pretty JSON

I formatted all the JSON files in the lang directory with jq to make them easier to compare.

for filepath in $(find -name "*.json"); do cat $filepath | jq > $filepath.tmp && mv $filepath.tmp $filepath; done

FYI, the ko_kr.json translation is incomplete, but I can't help you with this one. Maybe @AsseyGithub could give it a shot.

Cheers

@kkempfer kkempfer changed the title Add fr_fr.json and es_es.json Add fr_fr.json and es_es.json, git config to manage line endings Mar 25, 2024
@kkempfer kkempfer changed the title Add fr_fr.json and es_es.json, git config to manage line endings Add fr_fr.json and es_es.json. Git config to manage line endings Mar 25, 2024
@kkempfer kkempfer changed the title Add fr_fr.json and es_es.json. Git config to manage line endings Add fr_fr.json and es_es.json. Configure Git to manage line endings Mar 25, 2024
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.

2 participants