Skip to content
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

Fix « Name » ZiM metadata #208

Merged
merged 1 commit into from
Mar 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions steps/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { hideBin } from 'yargs/helpers'
import { fileURLToPath } from 'url'
import { catalogJs } from '../res/templates/catalog.js'
import Banana from 'banana-i18n'
import { iso6393To1 } from 'iso-639-3'

dotenv.config()

Expand Down Expand Up @@ -150,11 +151,12 @@ const exportTarget = async (target: Target, bananaI18n: Banana) => {
.map(async (file) => fs.promises.copyFile(file, `${targetDir}${path.basename(file)}`)),
)

const languageCode = target.languages.length > 1 ? 'mul' : getISO6393(target.languages[0]) || 'mul'
const iso6393LanguageCode = target.languages.length > 1 ? 'mul' : getISO6393(target.languages[0]) || 'mul'
const iso6391LanguageCode = target.languages.length > 1 ? 'mul' : iso6393To1[iso6393LanguageCode]

const iso6393LanguageCodes = target.languages.map(getISO6393)

let locale = languageCode === 'mul' ? 'en' : target.languages[0]
let locale = iso6393LanguageCode === 'mul' ? 'en' : target.languages[0]
if (locale !== 'en') {
const translations = await loadTranslations(locale)

Expand All @@ -169,11 +171,11 @@ const exportTarget = async (target: Target, bananaI18n: Banana) => {
{
fileName: `./dist/${target.output}.zim`,
welcome: 'index.html',
fullTextIndexLanguage: languageCode,
fullTextIndexLanguage: iso6393LanguageCode,
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be getISO6393(target.languages[0]) instead? I think iso6393LanguageCode would contain mul which would disturb indexing.

compression: 'zstd',
},
{
Name: `phets_${languageCode}`,
Name: `phets_${iso6391LanguageCode}_all`,
Title: bananaI18n.getMessage('zim-title'),
Description: bananaI18n.getMessage('zim-description'),
Creator: 'University of Colorado',
Expand Down