mirror of
https://github.com/transloadit/uppy.git
synced 2026-01-23 02:25:07 +00:00
Support locale variants (#1614)
This commit is contained in:
parent
6ac5253a6f
commit
f9f4b5d74b
1 changed files with 10 additions and 2 deletions
|
|
@ -191,13 +191,21 @@ function injectLocaleList () {
|
|||
|
||||
glob.sync(localePackagePath).forEach((localePath) => {
|
||||
const localeName = path.basename(localePath, '.js')
|
||||
const localeNameWithDash = localeName.replace('_', '-')
|
||||
let localeNameWithDash = localeName.replace('_', '-')
|
||||
|
||||
const parts = localeNameWithDash.split('-')
|
||||
let variant = ''
|
||||
if (parts.length > 2) {
|
||||
variant = parts.pop()
|
||||
localeNameWithDash = parts.join('-')
|
||||
}
|
||||
|
||||
const languageName = LocaleCode.getLanguageName(localeNameWithDash)
|
||||
const countryName = LocaleCode.getCountryName(localeNameWithDash)
|
||||
const npmPath = `<code><a href="https://www.npmjs.com/package/@uppy/locales">@uppy/locales</a>/lib/${localeName}</code>`
|
||||
const cdnPath = `[\`${localeName}.min.js\`](https://transloadit.edgly.net/releases/uppy/v${localePackageVersion}/locales/${localeName}.min.js)`
|
||||
const githubSource = `[\`${localeName}.js\`](https://github.com/transloadit/uppy/blob/master/packages/%40uppy/locales/src/${localeName}.js)`
|
||||
const mdTableRow = `| ${languageName}<br/> <small>(${countryName})</small> | ${npmPath} | ${cdnPath} | ✏️ ${githubSource} |`
|
||||
const mdTableRow = `| ${languageName}<br/> <small>(${countryName}${variant ? `, ${variant}` : ''})</small> | ${npmPath} | ${cdnPath} | ✏️ ${githubSource} |`
|
||||
mdRows.push(mdTableRow)
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue