Ethnolib is a small collection of browser components for language apps. Each component may be published to its own npm package.
A package for fuzzy-searching for languages, with language database based on langtags.json. It also includes various utilities for working with language tags and language info.
A React hook that provides the logic for a language chooser component. It utilizes the find-language
component.
A MUI styled language chooser interface, initially developed for use in BloomDesktop. It uses the language-chooser-react-hook
component.
Ethnolib is a monorepo using nx, with npm for package management.
We recommend installing nx globally.
npm i -g nx
. If you prefer not to, you can simply prefix all commands with with npx
instead.
Nx caches builds for efficiency. To clear the local cache, run nx reset
.
Use nx to build or run a hot-reload development server for a package if relevant. For example, to build or run the MUI language chooser demo:
nx build @ethnolib/language-chooser-react-mui
or
nx dev @ethnolib/language-chooser-react-mui
Vitest is used for writing unit tests. From the top level folder, all of the unit tests can be run with these commands:
npm run test
or
npm run testonce
The first command runs the tests continually in watch mode with minimal output while tests are passing successfully. The second command runs all the tests just once and quits after printing a summary of test results to the console window.
We are currently having all packages manage their own dependencies in their package level package.json
files, but keeping them all on the same versions of commonly used packages for compatibility. Current versions:
"react": "^17.0.2",
"@mui/material": "^5.15.19",
"@emotion/react": "^11.11.4",