Help Wanted from RegEx/Bash wizard(s) for AP website

Hello,

I’m trying to make a GitHub Action that turns the translations files for the website into actually translated content. The Action needs to execute a command for each markdown file (website page) and in each language (so I’ll need to find a way to get a double for loop).

I want to create a bash array for the languages, based on the list of languages as defined in the website’s _config.yml file. The file contains the following line:

languages: [en, nl, de]

More languages could of course be added. For the foreseeable future we’ll probably have an array with only one value: en.

So, based on that line in that file, how do I create an array that I can use in bash? I guess there’s two parts:

  • what is the right RegEx to filter out each of the languages
  • how to turn the RegEx finds into a Bash array (I think I can use this in combination with grep instead of find)

Any help would be very welcome! :slight_smile:

Single loop I have so far

The code I currently have to create translated files for a specific section, in this case ‘general’:
cd _i18n/en/general && for file in *; do po2md $file --po-files ../../PO-files/site-general_nl.PO --save ../../nl/general/$file; done