Django - Rosetta : Ignore .mo files issue

1.4k Views Asked by At

I'm using:

  • Rosetta - 0.7.2
  • Django - 1.4.3

What I'm trying:

  • Ignore the .mo files but keep tracking .po

I've been using Rosetta and Django for the past year and never had an issue like this. I want to ignore .mo files, but not the .po ones. The .mo files represent the compiled value of the .po files. My goal is when I change any translation in develop, I want git to ignore the .mo files.

I have 9 languages in the actual project, I tried to add in my .gitignore file this:

*.mo

but it doesn't work. I've also tried:

myapp/locale/*/LC_MESSAGES/*.mo

but didn't work neither, I tried:

myapp/locale/en/LC_MESSAGES/*.mo
myapp/locale/fr/LC_MESSAGES/*.mo
myapp/locale/es/LC_MESSAGES/*.mo
myapp/locale/tr/LC_MESSAGES/*.mo

This works but I don't want to add each language path to the .mo files because in the future I'd probably need to add more languages and want to avoid modifying the .gitignore file each time.

Any ideas about how to achieve this ?

More info:

  • I've removed/discarded changes each time I tried something
  • I had multiple .gitignore files, but now it's only one
  • As far as I know the rule *.mo in .gitignore should ignore all files, no matter the path, same as .*pyc ignore all compiled files
2

There are 2 best solutions below

0
On BEST ANSWER

Once I had same issue to remove *.sql files from git, and my problem was that the .sql file was in the repository, so although I delete in develop and add *.sql to gitignore, git never ignore them because they were already in the repository.

So I recommend you to delete all .mo files from repository, and then add *.mo to your .gitignore file and upload it, then it should ignore all your .mo files.

0
On

Steps are

  1. git rm -r --cached . which will ignore already tracked files and which are in your .gitignore
  2. git add .

  3. git commit -m ".gitignore is now working"