Consuming a .yml file

Hey gang,

Ruby has got a built in function (at least with the build we have), e.g.:

YAML.safe_load(, 'plugins', 'discourse-custom-wizard', 'config', 'national_flags.yml')))

But what to do in javascript?

I’ve seen suggestions to use this library, but I need to consume it on the client, not in node:

There seems to be a minified version to use in browsers.

However, what is the recommended “Discourse approach”? I was unable to find an example on the client side.

The reason I ask is that I’m about to PR a third party plugin and I’d rather not have to wire up a new rails method if I don’t need to, but am happy to go that route if it’s the recommended approach. This means it’s a bigger change to his plugin though.


Guys, I’m probably about to do this in anger as a PR to someone else’s plugin.

After thinking about this I’m going to go the Ruby route to avoid adding an additional library.

Now I just have to work out how to set up the localisation. Hmmmm…

I wonder if I can get away with putting 300 key values in the client yml file …

Yeah, I would definitely recommend doing yml parsing on the server rather than the client.