-
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added command line parameter to not create zim for languages with variants #206
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,13 @@ npm i && npm start | |
The above will eventually output a ZIM file to ```dist/``` | ||
|
||
## Command line arguments | ||
`--withoutLanguageVariants` uses to exclude languages with County variant. For example `en_ca` will not be present in zim with this argument. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. is that not "en-CA"? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the phet site, we are getting "en_CA" |
||
|
||
Available only on GET step: | ||
```bash | ||
--withoutLanguageVariants ... | ||
``` | ||
|
||
Available on GET and EXPORT steps only: | ||
```bash | ||
--includeLanguages lang_1 [lang_2] [lang_3] ... | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ import { hideBin } from 'yargs/helpers' | |
|
||
dotenv.config() | ||
|
||
const { argv } = yargs(hideBin(process.argv)).array('includeLanguages').array('excludeLanguages') | ||
const { argv } = yargs(hideBin(process.argv)).boolean('withoutLanguageVariants').array('includeLanguages').array('excludeLanguages') | ||
|
||
const failedDownloadsCountBeforeStop = 10 | ||
const outDir = 'state/get/' | ||
|
@@ -81,6 +81,9 @@ const fetchLanguages = async (): Promise<void> => { | |
rows.forEach((item) => { | ||
const url = $(item).find('td.list-highlight-background:first-child a').attr('href') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix problems |
||
const slug = /locale=(.*)$/.exec(url)?.pop() | ||
if (argv.withoutLanguageVariants && slug.includes('_')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have a log entry There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It should not be based on the slug, but on the lang. This is not robust. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Slug it just a variable name. It is filled from the |
||
return | ||
} | ||
const name = $(item).find('td.list-highlight-background:first-child a span').text() | ||
|
||
const nativeLangName = ISO6391.getNativeName(slug) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo