diff --git a/.gitignore b/.gitignore index 80df109595be1fed17bd14c31337cd93c5704802..4ac4c56f41ede32945455cd3a89327d258af86a5 100644 --- a/.gitignore +++ b/.gitignore @@ -46,5 +46,10 @@ redis /public/packs /node_modules + +# Ignore npm debug log +npm-debug.log + # Ignore Docker option files docker-compose.override.yml + diff --git a/app/javascript/mastodon/locales/he.json b/app/javascript/mastodon/locales/he.json index f8945dc1c845ad8fad132a61e1f9da0a303dcad0..82f4d323d785f1a2ae1d25dfdd743a0db410a9a9 100644 --- a/app/javascript/mastodon/locales/he.json +++ b/app/javascript/mastodon/locales/he.json @@ -4,8 +4,8 @@ "account.edit_profile": "עריכת פרופיל", "account.follow": "מעקב", "account.followers": "עוקבי×", - "account.follows_you": "במעקב ×חריך", "account.follows": "× ×¢×§×‘×™×", + "account.follows_you": "במעקב ×חריך", "account.mention": "×זכור של @{name}", "account.mute": "להשתיק ×ת @{name}", "account.posts": "הודעות", @@ -53,8 +53,9 @@ "emoji_button.travel": "×˜×™×•×œ×™× ×•×תרי×", "empty_column.community": "טור הסביבה ריק. יש ×œ×¤×¨×¡× ×ž×©×”×• כדי ×©×“×‘×¨×™× ×™×ª×¨×—×™×œ×• להתגלגל!", "empty_column.hashtag": "×ין ×›×œ×•× ×‘×”×שתג ×”×–×” עדיין.", - "empty_column.home.public_timeline": "בפרהסיה", "empty_column.home": "××£ ×חד ×œ× ×‘×ž×¢×§×‘ עדיין. ×פשר לבקר ב{public} ×ו להשתמש בחיפוש כדי להתחיל ולהכיר ×—×¦×•×¦×¨× ×™× ×חרי×.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", + "empty_column.home.public_timeline": "בפרהסיה", "empty_column.notifications": "×ין התר×ות עדיין. ×™×ללה, ×”×’×™×¢ הזמן להתחיל להתערבב!", "empty_column.public": "×ין פה כלו×! כדי ×œ×ž×œ× ×ת הטור ×”×–×” ×פשר לכתוב משהו, ×ו להתחיל לעקוב ×חרי ×× ×©×™× ×ž×§×”×™×œ×•×ª ×חרות.", "follow_request.authorize": "קבלה", @@ -84,7 +85,6 @@ "navigation_bar.public_timeline": "בפרהסיה", "notification.favourite": "חצרוצך חובב על ידי {name}", "notification.follow": "{name} במעקב ×חרייך", - "notification.mention": "×וזכרת ×¢\"×™ {name}", "notification.reblog": "חצרוצך הודהד על ידי {name}", "notifications.clear": "הסרת התר×ות", "notifications.clear_confirmation": "להסיר ×ת כל ההתר×ות? בטוח?", @@ -131,7 +131,6 @@ "report.submit": "שליחה", "report.target": "דיווח", "search.placeholder": "חיפוש", - "search.status_by": "הודעה מ×ת {name}", "search_results.total": "{count, number} {count, plural, one {תוצ××”} other {תוצ×ות}}", "status.cannot_reblog": "×œ× × ×™×ª×Ÿ להדהד הודעה זו", "status.delete": "מחיקה", @@ -145,8 +144,8 @@ "status.reply": "תגובה", "status.replyAll": "תגובה לכול×", "status.report": "דיווח על @{name}", - "status.sensitive_warning": "תוכן רגיש", "status.sensitive_toggle": "לחצו כדי לר×ות", + "status.sensitive_warning": "תוכן רגיש", "status.show_less": "הר××” פחות", "status.show_more": "הר××” יותר", "tabs_bar.compose": "חיבור", @@ -162,4 +161,4 @@ "video_player.toggle_sound": "הפעלת\\ביטול שמע", "video_player.toggle_visible": "הפעלת\\ביטול תצוגה", "video_player.video_error": "×œ× × ×™×ª×Ÿ ×œ× ×’×Ÿ ויד×ו" -} +} \ No newline at end of file diff --git a/app/javascript/mastodon/locales/pl.json b/app/javascript/mastodon/locales/pl.json index 525a35510dd3f16a6373f82b36d884666627dc2e..1d0bc1ac0124d8b4a647358eb2078e4ad4fcecf8 100644 --- a/app/javascript/mastodon/locales/pl.json +++ b/app/javascript/mastodon/locales/pl.json @@ -53,8 +53,9 @@ "emoji_button.travel": "Podróże i miejsca", "empty_column.community": "Lokalna oÅ› czasu jest pusta. Napisz coÅ› publicznie, aby odbić piÅ‚eczkÄ™!", "empty_column.hashtag": "Nie ma postów oznaczonych tym hashtagiem. Możesz napisać pierwszy!", - "empty_column.home.public_timeline": "publiczna oÅ› czasu", "empty_column.home": "Nie obserwujesz nikogo. Odwiedź publicznÄ… oÅ› czasu lub użyj wyszukiwarki, aby znaleźć ciekawych ludzi.", + "empty_column.home.inactivity": "Your home feed is empty. If you have been inactive for a while, it will be regenerated for you soon.", + "empty_column.home.public_timeline": "publiczna oÅ› czasu", "empty_column.notifications": "Nie masz żadnych powiadomieÅ„. Rozpocznij interakcje z innymi użytkownikami.", "empty_column.public": "Tu nic nie ma! Napisz coÅ› publicznie, lub dodaj ludzi z innych instancji, aby to wyÅ›wietlić.", "follow_request.authorize": "Autoryzuj", @@ -84,7 +85,6 @@ "navigation_bar.public_timeline": "OÅ› czasu federacji", "notification.favourite": "{name} dodaÅ‚ twój status do ulubionych", "notification.follow": "{name} zaczÄ…Å‚ ciÄ™ obserwować", - "notification.mention": "{name} wspomniaÅ‚ o tobie", "notification.reblog": "{name} podbiÅ‚ twój status", "notifications.clear": "Wyczyść powiadomienia", "notifications.clear_confirmation": "Czy na pewno chcesz bezpowrotnie usunąć wszystkie powiadomienia?", @@ -131,7 +131,6 @@ "report.submit": "WyÅ›lij", "report.target": "ZgÅ‚aszanie", "search.placeholder": "Szukaj", - "search.status_by": "Status od {name}", "search_results.total": "{count, number} {count, plural, one {wynik} more {wyniki}}", "status.cannot_reblog": "Ten post nie może zostać podbity", "status.delete": "UsuÅ„", @@ -161,5 +160,5 @@ "video_player.expand": "PrzeÅ‚Ä…cz wideo", "video_player.toggle_sound": "PrzeÅ‚Ä…cz dźwiÄ™k", "video_player.toggle_visible": "PrzeÅ‚Ä…cz widoczność", - "video_player.video_error": "Nie można odtworzyć pliku wideo", -}; \ No newline at end of file + "video_player.video_error": "Nie można odtworzyć pliku wideo" +} \ No newline at end of file diff --git a/app/javascript/mastodon/locales/whitelist_he.json b/app/javascript/mastodon/locales/whitelist_he.json new file mode 100644 index 0000000000000000000000000000000000000000..32960f8ced39dd5eade0f15d41e275b2dc8d4c70 --- /dev/null +++ b/app/javascript/mastodon/locales/whitelist_he.json @@ -0,0 +1,2 @@ +[ +] \ No newline at end of file diff --git a/app/javascript/mastodon/locales/whitelist_pl.json b/app/javascript/mastodon/locales/whitelist_pl.json new file mode 100644 index 0000000000000000000000000000000000000000..32960f8ced39dd5eade0f15d41e275b2dc8d4c70 --- /dev/null +++ b/app/javascript/mastodon/locales/whitelist_pl.json @@ -0,0 +1,2 @@ +[ +] \ No newline at end of file diff --git a/config/webpack/configuration.js b/config/webpack/configuration.js index 61c5b821faa6850c7b274e19b5de3391c8cf3f5e..e2f8d2d8bcc400832086fc552ec90bc8c41279e6 100644 --- a/config/webpack/configuration.js +++ b/config/webpack/configuration.js @@ -7,8 +7,8 @@ const { readFileSync } = require('fs') const configPath = resolve('config', 'webpack') const loadersDir = join(__dirname, 'loaders') -const paths = safeLoad(readFileSync(join(configPath, 'paths.yml'), 'utf8'))[env.NODE_ENV] -const devServer = safeLoad(readFileSync(join(configPath, 'development.server.yml'), 'utf8'))[env.NODE_ENV] +const paths = safeLoad(readFileSync(join(configPath, 'paths.yml'), 'utf8'))[env.NODE_ENV || 'development'] +const devServer = safeLoad(readFileSync(join(configPath, 'development.server.yml'), 'utf8'))[env.NODE_ENV || 'development'] // Compute public path based on environment and CDN_HOST in production const ifHasCDN = env.CDN_HOST !== undefined && env.NODE_ENV === 'production' diff --git a/config/webpack/translationRunner.js b/config/webpack/translationRunner.js index c636170b9f3d88e467a438d95edf250ae3c5e7cd..937c2edd00113c6538969c5f10e29953e221542f 100644 --- a/config/webpack/translationRunner.js +++ b/config/webpack/translationRunner.js @@ -1,34 +1,84 @@ +/*eslint no-console: "off"*/ const manageTranslations = require('react-intl-translations-manager').default; +const argv = require('minimist')(process.argv.slice(2)); +const fs = require('fs'); + +const translationsDirectory = 'app/javascript/mastodon/locales'; +const localeFn = /^([a-z]{2,3}(|\-[A-Z]+))\.json$/; +const reRFC5646 = /^[a-z]{2,3}(|\-[A-Z]+)$/; +const availableLanguages = fs.readdirSync(`${process.cwd()}/${translationsDirectory}`).reduce((acc, fn) => { + if (fn.match(localeFn)) { + acc.push(fn.replace(localeFn, '$1')); + } + return acc; +}, []); + +// print help message +if (argv.help !== undefined) { + console.log( +`Usage: yarn manage:translations -- [OPTIONS] [LANGUAGES] + +Manage javascript translation files in mastodon. Generates and update +translations in translationsDirectory: ${translationsDirectory} + +OPTIONS + --help show this message + --force force using the provided languages. create files if not exists. + default: false + +LANGUAGES +The RFC5646 language tag for the language you want to test or fix. If you want +to input multiple languages, separate them with space. + +Available languages: +${availableLanguages} +`); + process.exit(0); +} + +// determine the languages list +const languages = (argv._.length === 0) ? availableLanguages : argv._; + +// check if the languages provided are RFC5626 compliant +(function() { + let invalidLanguages = languages.reduce((acc, language) => { + if (!language.match(reRFC5646)) { + acc.push(language); + } + return acc; + }, []); + if (invalidLanguages.length > 0) { + console.log(`Error:`); + for (let language of invalidLanguages) { + console.error(`* Not RFC5626 name: ${language}`); + } + console.log(`\nUse yarn "manage:translations -- --help" for usage information\n`); + process.exit(1); + } +})(); + +// make sure the language exists. Unless force to create locale file. +if (argv.force !== true) { + let invalidLanguages = languages.reduce((acc, language) => { + if (availableLanguages.indexOf(language) < 0) { + acc.push(language); + } + return acc; + }, []); + if (invalidLanguages.length > 0) { + console.log(`Error:`); + for (let language of invalidLanguages) { + console.error(`* Language not available: ${language}`); + } + console.log(`\nIf you want to force creating the language(s) above, please add the --force option.\n`); + process.exit(1); + } +} manageTranslations({ messagesDirectory: 'build/messages', - translationsDirectory: 'app/javascript/mastodon/locales/', + translationsDirectory, detectDuplicateIds: false, singleMessagesFile: true, - languages: [ - 'ar', - 'en', - 'de', - 'es', - 'fa', - 'hr', - 'hu', - 'io', - 'it', - 'fr', - 'nl', - 'no', - 'oc', - 'pt', - 'pt-BR', - 'uk', - 'fi', - 'eo', - 'ru', - 'ja', - 'zh-HK', - 'zh-CN', - 'bg', - 'id', - ], -}) + languages, +}); diff --git a/package.json b/package.json index efe497138779f9bfd28868533c4510a404291daf..2475918b13a90d0b2338a1c09c9a494e1debbd0f 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "license": "AGPL-3.0", "scripts": { "postversion": "git push --tags", + "build:development": "NODE_ENV=development yarn webpack -- --config config/webpack/development.js", + "build:production": "NODE_ENV=production yarn webpack -- --config config/webpack/production.js", "manage:translations": "node ./config/webpack/translationRunner.js", "start": "babel-node ./streaming/index.js --presets es2015,stage-2", "storybook": "start-storybook -p 9001 -c storybook", @@ -113,6 +115,7 @@ "eslint-plugin-jsx-a11y": "^4.0.0", "eslint-plugin-react": "^6.10.3", "jsdom": "^9.11.0", + "minimist": "^1.2.0", "mocha": "^3.2.0", "react-intl-translations-manager": "^5.0.0", "webpack-dev-server": "^2.4.5"