Problem / Motivation:
Building the documentation can be time consuming, because every time it has to rebuild all the languages defined in languages.txt. In the case that you are translating, you might be working and modifying just one language.
Solution:
This little patch provides a way to specify a list of languages to build to the mkoutput.sh script, so you can only rebuild one language. In my case, i want to rebuild just the spanish documentation, since i am working on it's translation.
# Usage:
# "./mkoutput.sh" without parameters will build all the languages defined in languages.txt
# "./mkoutput.sh lang1 lang2 lang3" will build the documentation for all the languages passed as parameters.
# lang1 lang2 lang3 represent valid language codes.
For example:
"./mkoutput.sh es" would just build the spanish docs.
Should be a fairly trivial change, but wanted to get some feedback as i am quite new contributing in Drupal. Later the change can also be incorporated into ./mkfeeds.sh, ./mkebooks.sh, etc.
Comment | File | Size | Author |
---|---|---|---|
filter-build-languages.patch | 1.03 KB | guiu.rocafort.ferrer |
Comments
Comment #2
jhodgdonWhen I want to build just one language or a subset, I usually just locally edit the languages.txt file. Since it's in a Git repository, after I'm done it's easy enough to just do a
git checkout languages.txt
.But this seems like a good idea too. Does it work? :) I will test it later and commit it. Thanks!
Comment #3
jhodgdonThere are 2 other mk(something) scripts that should also be updated in the same way.
Comment #5
guiu.rocafort.ferrerI was working a little bit more on this and got some improvements.
I modified the rest of the mk scripts to also accept same parameters.
The mkzips.sh also accepts them after the version parameter, and added a bit of validation to make sure the script is called at least with the version tag.
Also, I created a script mkall.sh to execute all the different mk scripts, with the same custom languages.
All the scripts where tested with different combinations, of parameters, i believe i covered all of them.
I will commit the changes to the repository so you can test them in your local machines.
Comment #6
guiu.rocafort.ferrerComment #7
jhodgdonHm. The commit you made seems to have added a mkall.sh script but I don't see changes to the other scripts.
Oh I see, the other two commits didn't reference this issue. That's OK.
Thanks!
Comment #8
eojthebraveThis is super useful. Thanks @guiu.rocafort.ferrer.
Comment #9
jhodgdonThe mkzips.sh command no longer works for me. When running it with no args, I get:
I just edited my local copy to revert the commit... but it needs attention.
Comment #10
jhodgdonOne note: you are not supposed to run that command with no args -- it requires the version number, but it still shouldn't crash. I didn't try it with the correct args.
Comment #11
guiu.rocafort.ferrerOk, sorry about that. I will have a look in the next hours to fix it.
What should be the behaviour when there is no version number specified ?
Comment #12
jhodgdonWell, probably the old script didn't behave well either. Ideally, I think it would give you a message like "You need to provide the version number". The author of the old script (me) didn't bother with nice things like that. ;}
So... we could probably just leave it. I did verify that if you provide the version number, the script works fine.
Comment #13
jhodgdonOne other minor problem to fix: There are spaces at the ends of some lines. Please remove them -- we don't like end-of-line whitespace in the Drupal project. You can usually set your code editor to remove or highlight end-of-line spaces. Thanks!
Comment #14
jhodgdonFor reference, here is the other commit that was made for this issue (not automatically linked here):
https://git.drupalcode.org/project/user_guide/commit/01d50888835eefc7d6c...
Comment #15
jhodgdonSo before the change, if you ran mkzips.sh without specifying the version string, you would get:
This is not a beautiful error message, but it seems a bit clearer than #9.
It looks like the new script is trying to detect that the argument is missing, but it just isn't working (at least for me):
Comment #17
guiu.rocafort.ferrerThere was a syntax problem with the conditional checking the parameters.
I corrected it and tested in my local machine. Seems to be corrected, and now it fails properly with the "need to specify one parameter" message.
I also addressed the endline whitespace issues.
Comment #18
jhodgdonLooks good, thanks for the quick action!