question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Simplify the non-English curriculum challenge markdown files

See original GitHub issue

Since the challenge tests are no longer relying on the assert message and using the yaml text, I was wondering if the non-English .md challenge files could be simplified to only contain translations and no code at all. For example, the following is the English version of:

---
id: 56533eb9ac21ba0edf2244cc
title: Accessing Nested Objects
challengeType: 1
guideUrl: 'https://www.freecodecamp.org/guide/certificates/accessing-nested-objects-in-json'
---

## Description
<section id='description'>
The sub-properties of objects can be accessed by chaining together the dot or bracket notation.
Here is a nested object:
<blockquote>var ourStorage = {<br>&nbsp;&nbsp;"desk": {<br>&nbsp;&nbsp;&nbsp;&nbsp;"drawer": "stapler"<br>&nbsp;&nbsp;},<br>&nbsp;&nbsp;"cabinet": {<br>&nbsp;&nbsp;&nbsp;&nbsp;"top drawer": { <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"folder1": "a file",<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"folder2": "secrets"<br>&nbsp;&nbsp;&nbsp;&nbsp;},<br>&nbsp;&nbsp;&nbsp;&nbsp;"bottom drawer": "soda"<br>&nbsp;&nbsp;}<br>};<br>ourStorage.cabinet["top drawer"].folder2;  // "secrets"<br>ourStorage.desk.drawer; // "stapler"</blockquote>
</section>

## Instructions
<section id='instructions'>
Access the <code>myStorage</code> object and assign the contents of the <code>glove box</code> property to the <code>gloveBoxContents</code> variable. Use bracket notation for properties with a space in their name.
</section>

## Tests
<section id='tests'>

```yml
tests:
  - text: <code>gloveBoxContents</code> should equal "maps"
    testString: assert(gloveBoxContents === "maps", '<code>gloveBoxContents</code> should equal "maps"');
  - text: Use dot and bracket notation to access <code>myStorage</code>
    testString: assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code), 'Use dot and bracket notation to access <code>myStorage</code>');

```

</section>

## Challenge Seed
<section id='challengeSeed'>

<div id='js-seed'>

```js
// Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

var gloveBoxContents = undefined; // Change this line

```

</div>


### After Test
<div id='js-teardown'>

```js
(function(x) { 
  if(typeof x != 'undefined') { 
    return "gloveBoxContents = " + x;
  }
  return "gloveBoxContents is undefined";
})(gloveBoxContents);
```

</div>

</section>

## Solution
<section id='solution'>


```js
var myStorage = {
  "car":{
    "inside":{
      "glove box":"maps",
      "passenger seat":"crumbs"
    },
    "outside":{
      "trunk":"jack"
    }
  }
};
var gloveBoxContents = myStorage.car.inside["glove box"];
```

</section>

Maybe there is a way to write the tests runner logic to use a simplified markdown file like the following (Spanish version shown below):

---
id: 56533eb9ac21ba0edf2244cc
guideUrl: 'https://spanish.freecodecamp.org/guide/certificates/accessing-nested-objects-in-json'
localeTitle: Accediendo a objetos anidados
---

## Description
<section id="description"> Se puede acceder a las sub-propiedades de los objetos encadenando la notación de punto o corchete. Aquí hay un objeto anidado: <blockquote> var ourStorage = { <br> &quot;escritorio&quot;: { <br> &quot;cajón&quot;: &quot;grapadora&quot; <br> } <br> &quot;gabinete&quot;: { <br> &quot;cajón de arriba&quot;: { <br> &quot;folder1&quot;: &quot;un archivo&quot;, <br> &quot;folder2&quot;: &quot;secretos&quot; <br> } <br> &quot;cajón inferior&quot;: &quot;soda&quot; <br> } <br> }; <br> ourStorage.cabinet [&quot;cajón superior&quot;]. folder2; // &quot;secretos&quot; <br> ourStorage.desk.drawer; // &quot;engrapadora&quot; </blockquote></section>

## Instructions
<section id="instructions"> Acceda al objeto <code>myStorage</code> y asigne el contenido de la propiedad <code>glove box</code> a la variable <code>gloveBoxContents</code> . Utilice la notación de corchete para las propiedades con un espacio en su nombre. </section>

## Tests
<section id='tests'>

```yml
tests:
  - text: <code>gloveBoxContents</code> debe ser igual a &quot;mapas&quot;
  - text: Usa la notación de puntos y corchetes para acceder a <code>myStorage</code>

```

</section>

You could possibly get rid of the front matter title along with tests section testString. The only tricky part would be getting rid of the Challenge Seed, because sometimes there are comments in the code (think React challenges) that would need some translations. Maybe there is a way to add some placeholders for comments in the English code (like a ref #) and then have a Challenge Seed Comments section in the non-English markdown with references to the #s like:

## Challenge Seed Comments
<section id='challenge-seed-comments'>

```yml
comments:
  - comment1: // Setup
  - comment2: // Change this line

```

</section>

Then in the English version of the Challenge Seed, any comments would look something like:

//comment1 Setup
var myStorage = {
  "car": {
    "inside": {
      "glove box": "maps",
      "passenger seat": "crumbs"
     },
    "outside": {
      "trunk": "jack"
    }
  }
};

var gloveBoxContents = undefined; //comment2 Change this line

This is probably not the simplest way to achieve this, but hopefully you get the idea of what I am talking about. I am hoping to use this issue as a way to discuss how this could be achieved.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
RandellDawsoncommented, Feb 16, 2019

@lynxlynxlynx Not sure if you are aware, but we can already write the test section like (due to a PR @ValeraS already merged:

Instead of:

  - text: <code>gloveBoxContents</code> should equal "maps"
    testString: assert(gloveBoxContents === "maps", '<code>gloveBoxContents</code> should equal "maps"');
  - text: Use dot and bracket notation to access <code>myStorage</code>
    testString: assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code), 'Use dot and bracket notation to access <code>myStorage</code>');

we can now do this:

  - text: <code>gloveBoxContents</code> should equal "maps"
    testString: assert(gloveBoxContents === "maps");
  - text: Use dot and bracket notation to access <code>myStorage</code>
    testString: assert(/=\s*myStorage\.car\.inside\[\s*("|')glove box\1\s*\]/g.test(code));

I had already started working on changing all the testStrings when I started thinking about how we could possibly remove the testString from the non-English versions. One way I can think about doing that is to use something like the following in the English version:

tests:
  - text_01: <code>gloveBoxContents</code> should equal "maps"
  - text_02: Use dot and bracket notation to access <code>myStorage</code>

and then something like this in the non-English version:

tests:
  - text_01: <code>gloveBoxContents</code> debe ser igual a "mapas"
  - text_02: Usa la notación de puntos y corchetes para acceder a <code>myStorage</code>

I am sure there are a lot of reasons why the above suggestion may not work, but there must be a way to get it to work without being too “hacky”.

Would you be interested in working together on a PR to accomplish this?

0reactions
lynxlynxlynxcommented, May 23, 2019

What, has all the hacktoberfest review been for nothing?!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Newcomer Tool Kit (PDF) - Department of Education
Guidelines for Teaching English Learners and Newcomers . ... immigrants and immigrant groups—have faced challenges integrating into American society.
Read more >
English Language Arts and Literacy
A well- rounded ELA curriculum should expose students to a rich diversity of high-quality, authentic literature from multiple genres, cultures, and time periods ......
Read more >
2015–2016 GUIDE - Montgomery County Public Schools
I encourage you to enroll in challenging courses in pursuit of your personal goals and ... rigorous English language arts (ELA)/literacy and mathematics....
Read more >
ESOL Customer Service Training Curriculum
There is no single author of this curriculum. ... challenging for a job candidate with limited English proficiency. ... Solve workplace problems as...
Read more >
What the Research Says About Immersion - Tara Williams ...
[x] Further, the more time spent learning through the non-English ... Pressing challenges include staffing, curriculum development and program articulation.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found