# Conflicts: # app/javascript/glitch/locales/ja.jsonclosed-social-glitch-2
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/ar.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/bg.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/ca.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/de.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,50 @@ | |||||
import inherited from 'mastodon/locales/en.json'; | |||||
const messages = { | |||||
'getting_started.open_source_notice': 'Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.', | |||||
'layout.auto': 'Auto', | |||||
'layout.current_is': 'Your current layout is:', | |||||
'layout.desktop': 'Desktop', | |||||
'layout.mobile': 'Mobile', | |||||
'navigation_bar.app_settings': 'App settings', | |||||
'getting_started.onboarding': 'Show me around', | |||||
'onboarding.page_one.federation': '{domain} is an \'instance\' of Mastodon. Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.', | |||||
'onboarding.page_one.welcome': 'Welcome to {domain}!', | |||||
'onboarding.page_six.github': '{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}, and is compatible with any Mastodon instance or app. Glitchsoc is entirely free and open-source. You can report bugs, request features, or contribute to the code on {github}.', | |||||
'settings.auto_collapse': 'Automatic collapsing', | |||||
'settings.auto_collapse_all': 'Everything', | |||||
'settings.auto_collapse_lengthy': 'Lengthy toots', | |||||
'settings.auto_collapse_media': 'Toots with media', | |||||
'settings.auto_collapse_notifications': 'Notifications', | |||||
'settings.auto_collapse_reblogs': 'Boosts', | |||||
'settings.auto_collapse_replies': 'Replies', | |||||
'settings.close': 'Close', | |||||
'settings.collapsed_statuses': 'Collapsed toots', | |||||
'settings.enable_collapsed': 'Enable collapsed toots', | |||||
'settings.general': 'General', | |||||
'settings.image_backgrounds': 'Image backgrounds', | |||||
'settings.image_backgrounds_media': 'Preview collapsed toot media', | |||||
'settings.image_backgrounds_users': 'Give collapsed toots an image background', | |||||
'settings.media': 'Media', | |||||
'settings.media_letterbox': 'Letterbox media', | |||||
'settings.media_fullwidth': 'Full-width media previews', | |||||
'settings.preferences': 'User preferences', | |||||
'settings.wide_view': 'Wide view (Desktop mode only)', | |||||
'settings.navbar_under': 'Navbar at the bottom (Mobile only)', | |||||
'status.collapse': 'Collapse', | |||||
'status.uncollapse': 'Uncollapse', | |||||
'home.column_settings.show_direct': 'Show DMs', | |||||
'notification.markForDeletion': 'Mark for deletion', | |||||
'notifications.clear': 'Clear all my notifications', | |||||
'notifications.marked_clear_confirmation': 'Are you sure you want to permanently clear all selected notifications?', | |||||
'notifications.marked_clear': 'Clear selected notifications', | |||||
'notification_purge.btn_all': 'Select\nall', | |||||
'notification_purge.btn_none': 'Select\nnone', | |||||
'notification_purge.btn_invert': 'Invert\nselection', | |||||
'notification_purge.btn_apply': 'Clear\nselected', | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/eo.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/es.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/fa.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/fi.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/fr.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/he.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/hr.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/hu.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/id.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/io.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/it.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/ko.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/nl.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/no.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/oc.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,48 @@ | |||||
import inherited from 'mastodon/locales/pl.json'; | |||||
const messages = { | |||||
'getting_started.open_source_notice': 'Glitchsoc jest wolnym i otwartoźródłowym forkiem oprogramowania {Mastodon}. Możesz współtworzyć projekt lub zgłaszać błędy na GitHubie pod adresem {github}.', | |||||
'layout.auto': 'Automatyczny', | |||||
'layout.current_is': 'Twój obecny układ to:', | |||||
'layout.desktop': 'Desktopowy', | |||||
'layout.mobile': 'Mobilny', | |||||
'navigation_bar.app_settings': 'Ustawienia aplikacji', | |||||
'getting_started.onboarding': 'Rozejrzyj się', | |||||
'onboarding.page_one.federation': '{domain} jest \'instancją\' Mastodona. Mastodon to sieć działających niezależnie serwerów tworzących jedną sieć społecznościową. Te serwery nazywane są instancjami.', | |||||
'onboarding.page_one.welcome': 'Witamy na {domain}!', | |||||
'onboarding.page_six.github': '{domain} jest oparty na Glitchsoc. Glitchsoc jest {forkiem} {Mastodon}a kompatybilnym z każdym klientem i aplikacją Mastodona. Glitchsoc jest całkowicie wolnym i otwartoźródłowym oprogramowaniem. Możesz zgłaszać błędy i sugestie funkcji oraz współtworzyć projekt na {github}.', | |||||
'settings.auto_collapse': 'Automatyczne zwijanie', | |||||
'settings.auto_collapse_all': 'Wszystko', | |||||
'settings.auto_collapse_lengthy': 'Długie wpisy', | |||||
'settings.auto_collapse_media': 'Wpisy z zawartością multimedialną', | |||||
'settings.auto_collapse_notifications': 'Powiadomienia', | |||||
'settings.auto_collapse_reblogs': 'Podbicia', | |||||
'settings.auto_collapse_replies': 'Odpowiedzi', | |||||
'settings.close': 'Zamknij', | |||||
'settings.collapsed_statuses': 'Zwijanie wpisów', | |||||
'settings.enable_collapsed': 'Włącz zwijanie wpisów', | |||||
'settings.general': 'Ogólne', | |||||
'settings.image_backgrounds': 'Obrazy w tle', | |||||
'settings.image_backgrounds_media': 'Wyświetlaj zawartość multimedialną zwiniętych wpisów', | |||||
'settings.image_backgrounds_users': 'Nadaj tło zwiniętym wpisom', | |||||
'settings.media': 'Zawartość multimedialna', | |||||
'settings.media_letterbox': 'Letterbox media', | |||||
'settings.media_fullwidth': 'Podgląd zawartości multimedialnej o pełnej szerokości', | |||||
'settings.preferences': 'Preferencje użyytkownika', | |||||
'settings.wide_view': 'Szeroki widok (tylko w trybie desktopowym)', | |||||
'settings.navbar_under': 'Pasek nawigacji na dole (tylko w trybie mobilnym)', | |||||
'status.collapse': 'Zwiń', | |||||
'status.uncollapse': 'Rozwiń', | |||||
'notification.markForDeletion': 'Oznacz do usunięcia', | |||||
'notifications.clear': 'Wyczyść wszystkie powiadomienia', | |||||
'notifications.marked_clear_confirmation': 'Czy na pewno chcesz bezpowrtonie usunąć wszystkie powiadomienia?', | |||||
'notifications.marked_clear': 'Usuń zaznaczone powiadomienia', | |||||
'notification_purge.btn_all': 'Zaznacz\nwszystkie', | |||||
'notification_purge.btn_none': 'Odznacz\nwszystkie', | |||||
'notification_purge.btn_invert': 'Odwróć\nzaznaczenie', | |||||
'notification_purge.btn_apply': 'Usuń\nzaznaczone', | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/pt-BR.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/pt.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/ru.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/sv.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/th.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/tr.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/uk.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/zh-CN.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/zh-HK.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,7 @@ | |||||
import inherited from 'mastodon/locales/zh-TW.json'; | |||||
const messages = { | |||||
// No translations available. | |||||
}; | |||||
export default Object.assign({}, inherited, messages); |
@ -0,0 +1,6 @@ | |||||
en: | |||||
flavours: | |||||
glitch: Glitch Edition | |||||
skins: | |||||
glitch: | |||||
default: Default |
@ -0,0 +1,6 @@ | |||||
en: | |||||
flavours: | |||||
vanilla: Vanilla Mastodon | |||||
skins: | |||||
vanilla: | |||||
default: Default |
@ -1,46 +0,0 @@ | |||||
{ | |||||
"getting_started.open_source_notice": "Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.", | |||||
"layout.auto": "Auto", | |||||
"layout.current_is": "Your current layout is:", | |||||
"layout.desktop": "Desktop", | |||||
"layout.mobile": "Mobile", | |||||
"navigation_bar.app_settings": "App settings", | |||||
"getting_started.onboarding": "Show me around", | |||||
"onboarding.page_one.federation": "{domain} is an 'instance' of Mastodon. Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.", | |||||
"onboarding.page_one.welcome": "Welcome to {domain}!", | |||||
"onboarding.page_six.github": "{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}, and is compatible with any Mastodon instance or app. Glitchsoc is entirely free and open-source. You can report bugs, request features, or contribute to the code on {github}.", | |||||
"settings.auto_collapse": "Automatic collapsing", | |||||
"settings.auto_collapse_all": "Everything", | |||||
"settings.auto_collapse_lengthy": "Lengthy toots", | |||||
"settings.auto_collapse_media": "Toots with media", | |||||
"settings.auto_collapse_notifications": "Notifications", | |||||
"settings.auto_collapse_reblogs": "Boosts", | |||||
"settings.auto_collapse_replies": "Replies", | |||||
"settings.close": "Close", | |||||
"settings.collapsed_statuses": "Collapsed toots", | |||||
"settings.enable_collapsed": "Enable collapsed toots", | |||||
"settings.general": "General", | |||||
"settings.image_backgrounds": "Image backgrounds", | |||||
"settings.image_backgrounds_media": "Preview collapsed toot media", | |||||
"settings.image_backgrounds_users": "Give collapsed toots an image background", | |||||
"settings.media": "Media", | |||||
"settings.media_letterbox": "Letterbox media", | |||||
"settings.media_fullwidth": "Full-width media previews", | |||||
"settings.preferences": "User preferences", | |||||
"settings.wide_view": "Wide view (Desktop mode only)", | |||||
"settings.navbar_under": "Navbar at the bottom (Mobile only)", | |||||
"status.collapse": "Collapse", | |||||
"status.uncollapse": "Uncollapse", | |||||
"home.column_settings.show_direct": "Show DMs", | |||||
"notification.markForDeletion": "Mark for deletion", | |||||
"notifications.clear": "Clear all my notifications", | |||||
"notifications.marked_clear_confirmation": "Are you sure you want to permanently clear all selected notifications?", | |||||
"notifications.marked_clear": "Clear selected notifications", | |||||
"notification_purge.btn_all": "Select\nall", | |||||
"notification_purge.btn_none": "Select\nnone", | |||||
"notification_purge.btn_invert": "Invert\nselection", | |||||
"notification_purge.btn_apply": "Clear\nselected" | |||||
} |
@ -1,44 +0,0 @@ | |||||
{ | |||||
"getting_started.open_source_notice": "Glitchsoc jest wolnym i otwartoźródłowym forkiem oprogramowania {Mastodon}. Możesz współtworzyć projekt lub zgłaszać błędy na GitHubie pod adresem {github}.", | |||||
"layout.auto": "Automatyczny", | |||||
"layout.current_is": "Twój obecny układ to:", | |||||
"layout.desktop": "Desktopowy", | |||||
"layout.mobile": "Mobilny", | |||||
"navigation_bar.app_settings": "Ustawienia aplikacji", | |||||
"getting_started.onboarding": "Rozejrzyj się", | |||||
"onboarding.page_one.federation": "{domain} jest 'instancją' Mastodona. Mastodon to sieć działających niezależnie serwerów tworzących jedną sieć społecznościową. Te serwery nazywane są instancjami.", | |||||
"onboarding.page_one.welcome": "Witamy na {domain}!", | |||||
"onboarding.page_six.github": "{domain} jest oparty na Glitchsoc. Glitchsoc jest {forkiem} {Mastodon}a kompatybilnym z każdym klientem i aplikacją Mastodona. Glitchsoc jest całkowicie wolnym i otwartoźródłowym oprogramowaniem. Możesz zgłaszać błędy i sugestie funkcji oraz współtworzyć projekt na {github}.", | |||||
"settings.auto_collapse": "Automatyczne zwijanie", | |||||
"settings.auto_collapse_all": "Wszystko", | |||||
"settings.auto_collapse_lengthy": "Długie wpisy", | |||||
"settings.auto_collapse_media": "Wpisy z zawartością multimedialną", | |||||
"settings.auto_collapse_notifications": "Powiadomienia", | |||||
"settings.auto_collapse_reblogs": "Podbicia", | |||||
"settings.auto_collapse_replies": "Odpowiedzi", | |||||
"settings.close": "Zamknij", | |||||
"settings.collapsed_statuses": "Zwijanie wpisów", | |||||
"settings.enable_collapsed": "Włącz zwijanie wpisów", | |||||
"settings.general": "Ogólne", | |||||
"settings.image_backgrounds": "Obrazy w tle", | |||||
"settings.image_backgrounds_media": "Wyświetlaj zawartość multimedialną zwiniętych wpisów", | |||||
"settings.image_backgrounds_users": "Nadaj tło zwiniętym wpisom", | |||||
"settings.media": "Zawartość multimedialna", | |||||
"settings.media_letterbox": "Letterbox media", | |||||
"settings.media_fullwidth": "Podgląd zawartości multimedialnej o pełnej szerokości", | |||||
"settings.preferences": "Preferencje użyytkownika", | |||||
"settings.wide_view": "Szeroki widok (tylko w trybie desktopowym)", | |||||
"settings.navbar_under": "Pasek nawigacji na dole (tylko w trybie mobilnym)", | |||||
"status.collapse": "Zwiń", | |||||
"status.uncollapse": "Rozwiń", | |||||
"notification.markForDeletion": "Oznacz do usunięcia", | |||||
"notifications.clear": "Wyczyść wszystkie powiadomienia", | |||||
"notifications.marked_clear_confirmation": "Czy na pewno chcesz bezpowrtonie usunąć wszystkie powiadomienia?", | |||||
"notifications.marked_clear": "Usuń zaznaczone powiadomienia", | |||||
"notification_purge.btn_all": "Zaznacz\nwszystkie", | |||||
"notification_purge.btn_none": "Odznacz\nwszystkie", | |||||
"notification_purge.btn_invert": "Odwróć\nzaznaczenie", | |||||
"notification_purge.btn_apply": "Usuń\nzaznaczone" | |||||
} |
@ -0,0 +1,4 @@ | |||||
en: | |||||
skins: | |||||
vanilla: | |||||
win95: Masto95 |
@ -0,0 +1,6 @@ | |||||
# frozen_string_literal: true | |||||
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'flavours', '*', 'names.{rb,yml}').to_s] | |||||
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'flavours', '*', 'names', '*.{rb,yml}').to_s] | |||||
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'skins', '*', '*', 'names.{rb,yml}').to_s] | |||||
I18n.load_path += Dir[Rails.root.join('app', 'javascript', 'skins', '*', '*', 'names', '*.{rb,yml}').to_s] |
@ -1,70 +1,66 @@ | |||||
// A message from upstream: | |||||
// ======================== | |||||
// To avoid adding a lot of boilerplate, locale packs are | // To avoid adding a lot of boilerplate, locale packs are | ||||
// automatically generated here. These are written into the tmp/ | // automatically generated here. These are written into the tmp/ | ||||
// directory and then used to generate locale_en.js, locale_fr.js, etc. | // directory and then used to generate locale_en.js, locale_fr.js, etc. | ||||
const fs = require('fs'); | |||||
const path = require('path'); | |||||
// Glitch note: | |||||
// ============ | |||||
// This code has been entirely rewritten to support glitch flavours. | |||||
// However, the underlying process is exactly the same. | |||||
const { existsSync, readdirSync, writeFileSync } = require('fs'); | |||||
const { join, resolve } = require('path'); | |||||
const rimraf = require('rimraf'); | const rimraf = require('rimraf'); | ||||
const mkdirp = require('mkdirp'); | const mkdirp = require('mkdirp'); | ||||
const { flavours } = require('./configuration.js'); | |||||
const localesJsonPath = path.join(__dirname, '../../app/javascript/mastodon/locales'); | |||||
const locales = fs.readdirSync(localesJsonPath).filter(filename => { | |||||
return /\.json$/.test(filename) && | |||||
!/defaultMessages/.test(filename) && | |||||
!/whitelist/.test(filename); | |||||
}).map(filename => filename.replace(/\.json$/, '')); | |||||
const outPath = path.join(__dirname, '../../tmp/packs'); | |||||
rimraf.sync(outPath); | |||||
mkdirp.sync(outPath); | |||||
const outPaths = []; | |||||
locales.forEach(locale => { | |||||
const localePath = path.join(outPath, `locale_${locale}.js`); | |||||
const baseLocale = locale.split('-')[0]; // e.g. 'zh-TW' -> 'zh' | |||||
const localeDataPath = [ | |||||
// first try react-intl | |||||
`../../node_modules/react-intl/locale-data/${baseLocale}.js`, | |||||
// then check locales/locale-data | |||||
`../../app/javascript/mastodon/locales/locale-data/${baseLocale}.js`, | |||||
// fall back to English (this is what react-intl does anyway) | |||||
'../../node_modules/react-intl/locale-data/en.js', | |||||
].filter(filename => fs.existsSync(path.join(outPath, filename))) | |||||
.map(filename => filename.replace(/..\/..\/node_modules\//, ''))[0]; | |||||
let glitchInject = ` | |||||
const mergedMessages = messages; | |||||
`; | |||||
const glitchPath = `../../app/javascript/glitch/locales/${locale}.json`; | |||||
if (fs.existsSync(path.join(outPath, glitchPath))) { | |||||
glitchInject = ` | |||||
import glitchMessages from ${JSON.stringify(glitchPath)}; | |||||
let mergedMessages = messages; | |||||
Object.keys(glitchMessages).forEach(function (key) { | |||||
mergedMessages[key] = glitchMessages[key]; | |||||
}); | |||||
`; | |||||
module.exports = Object.keys(flavours).reduce(function (map, entry) { | |||||
const flavour = flavours[entry]; | |||||
if (!flavour.locales) { | |||||
return map; | |||||
} | } | ||||
const locales = readdirSync(flavour.locales).filter( | |||||
filename => /\.js(?:on)?$/.test(filename) && !/defaultMessages|whitelist|index/.test(filename) | |||||
); | |||||
const outPath = resolve('tmp', 'locales', entry); | |||||
rimraf.sync(outPath); | |||||
mkdirp.sync(outPath); | |||||
const localeContent = `// | |||||
// locale_${locale}.js | |||||
locales.forEach(function (locale) { | |||||
const localeName = locale.replace(/\.js(?:on)?$/, ''); | |||||
const localePath = join(outPath, `${localeName}.js`); | |||||
const baseLocale = localeName.split('-')[0]; // e.g. 'zh-TW' -> 'zh' | |||||
const localeDataPath = [ | |||||
// first try react-intl | |||||
`node_modules/react-intl/locale-data/${baseLocale}.js`, | |||||
// then check locales/locale-data | |||||
`app/javascript/locales/locale-data/${baseLocale}.js`, | |||||
// fall back to English (this is what react-intl does anyway) | |||||
'node_modules/react-intl/locale-data/en.js', | |||||
].filter( | |||||
filename => existsSync(filename) | |||||
).map( | |||||
filename => filename.replace(/(?:node_modules|app\/javascript)\//, '') | |||||
)[0]; | |||||
const localeContent = `// | |||||
// locales/${entry}/${localeName}.js | |||||
// automatically generated by generateLocalePacks.js | // automatically generated by generateLocalePacks.js | ||||
// | // | ||||
import messages from '../../app/javascript/mastodon/locales/${locale}.json'; | |||||
import localeData from ${JSON.stringify(localeDataPath)}; | |||||
import { setLocale } from 'locales'; | |||||
${glitchInject} | |||||
setLocale({messages: mergedMessages, localeData: localeData}); | |||||
`; | |||||
fs.writeFileSync(localePath, localeContent, 'utf8'); | |||||
outPaths.push(localePath); | |||||
}); | |||||
module.exports = outPaths; | |||||
import messages from '../../../${flavour.locales}/${locale.replace(/\.js$/, '')}'; | |||||
import localeData from '${localeDataPath}'; | |||||
import { setLocale } from 'locales'; | |||||
setLocale({ | |||||
localeData, | |||||
messages, | |||||
}); | |||||
`; | |||||
writeFileSync(localePath, localeContent, 'utf8'); | |||||
map[`locales/${entry}/${localeName}`] = localePath; | |||||
}); | |||||
return map; | |||||
}, {}); |