Skip to content

Conversation

loyaltypollution
Copy link

Simple proof-of-concept for adding additional languages via a language-directory.

  • Wrote as feature flag to avoid breaking changes.

To-Do?

  • Add UI support to allow users to view language directory URLs in frontend.

Questions:

  • Is SourceAcademy planning to make conductors a “first-class” concept?
    • removing the hardcoding of languages in drop down?
    • ensuring that all -slang variants support conductors?

Happy to collaborate with relevant people on making conductors first-class if that’s the direction we are taking 👍

@martin-henz
Copy link
Member

Yes, the Source Academy frontends should be configurable to provide a desired set of languages and their implementations. The purpose of the language directory is to provide a mapping from language names to the "official" x-slang implementations.

What remains to be worked out is to configure what languages should be provided by sourceacademy.org and sourceacademy.nus.edu.sg and other frontends.

Should that be done in a config file at build time, or should this also come from a github page?

Any proposals?

@s-kybound
Copy link
Member

Should that be done in a config file at build time, or should this also come from a github page?
Any proposals?

@martin-henz best to be done in a config file i think, less layers of indirection especially when setting up new frontends.

@coveralls
Copy link

coveralls commented Sep 1, 2025

Pull Request Test Coverage Report for Build 17511560243

Details

  • 303 of 2359 (12.84%) changed or added relevant lines in 18 files are covered.
  • 4 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-1.4%) to 42.462%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/commons/controlBar/LegacyControlBarChapterSelect.tsx 68 69 98.55%
public/evaluators/pie-slang/pie.js 0 2 0.0%
src/commons/navigationBar/subcomponents/NavigationBarLangSelectButton.tsx 22 27 81.48%
src/commons/controlBar/ControlBarChapterSelect.tsx 43 49 87.76%
src/commons/featureFlags/publicFlags.ts 0 6 0.0%
public/evaluators/py-slang/standard.js 0 694 0.0%
public/evaluators/py-slang/pyscript.js 0 1342 0.0%
Files with Coverage Reduction New Missed Lines %
src/commons/navigationBar/subcomponents/NavigationBarLangSelectButton.tsx 4 81.82%
Totals Coverage Status
Change from base Build 17424153377: -1.4%
Covered Lines: 21065
Relevant Lines: 51962

💛 - Coveralls

Copy link
Member

@s-kybound s-kybound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor nits, after resolution LGTM! please make sure the frontend has been tested first.

@@ -41,6 +41,7 @@
"@reduxjs/toolkit": "^1.9.7",
"@sentry/react": "^10.5.0",
"@sourceacademy/c-slang": "^1.0.21",
"@sourceacademy/language-directory": "https://github.com/loyaltypollution/language-directory.git#866cc934372a19e514af0025947ce7f1f5a6e1fc",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it necessary for the language directory to point to your version?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that his version is newer than the version in SA. Might migrate to SA version after merging.

<ChapterSelectComponent
items={choices.filter(({ mainLanguage }) => mainLanguage === selectedLang)}
onItemSelect={handleChapterSelect}
itemRenderer={chapterRenderer(isFolderModeEnabled)}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it right to say that folder mode will be disabled for the new evaluators for now? if so please doc it as a limitation

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The folder mode works for new evaluators

}, [languagesLoaded, dispatch]);

const directoryEnabled = useFeature(flagLanguageDirectoryEnable);
if (!directoryEnabled) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this should be moved higher as a guard clause to cleanly separate logic. to my understanding the code above and below this correspond to the new Navigation bar lang select button, but this corresponds to the original button.

Copy link

@dingf3ng dingf3ng Sep 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Hook "useState" is called conditionally. React Hooks must be called in the exact same order in every component render.eslintreact-hooks/rules-of-hooks.
Seems some linting issues if move it higher. So we have to put it here. Correct me if I am wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants