From a8bd7cbbb0e80a457a34fa98a7a454943f6df523 Mon Sep 17 00:00:00 2001 From: casens5 Date: Tue, 27 Aug 2024 17:25:13 -0500 Subject: [PATCH] add translations --- front_end/messages/cs.json | 26 +++++-- front_end/messages/en.json | 24 +++++-- front_end/messages/zh.json | 25 +++++-- front_end/package-lock.json | 72 ++++++------------- .../[id]/components/choices_tooltip.tsx | 7 +- .../binary_group_chart.tsx | 2 +- .../forecast_maker/numeric_table.tsx | 64 +++++++++++------ .../src/app/embed/questions/[id]/page.tsx | 10 +-- front_end/src/components/charts/histogram.tsx | 4 +- .../charts/multiple_choice_chart.tsx | 6 +- .../src/components/comment_feed/comment.tsx | 20 +++--- .../components/comment_feed/comment_cmm.tsx | 12 +--- .../src/components/conditional_timeline.tsx | 2 - front_end/src/components/embed_modal.tsx | 22 +++--- 14 files changed, 169 insertions(+), 127 deletions(-) diff --git a/front_end/messages/cs.json b/front_end/messages/cs.json index 6687764fe6..33013767b7 100644 --- a/front_end/messages/cs.json +++ b/front_end/messages/cs.json @@ -19,7 +19,7 @@ "remove": "odstranit", "removed": "odstraněno", "reply": "Reagovat", - "cancelButton": "Zrušit", + "cancel": "Zrušit", "edit": "Upravit", "report": "Nahlásit", "delete": "Smazat", @@ -68,9 +68,9 @@ "unweighted": "Neváženo", "metaculus": "Metaculus", "community": "komunita", - "firstQuartileLabel": "první kvartil", - "secondQuartileLabel": "medián", - "thirdQuartileLabel": "třetí kvartil", + "firstQuartile": "první kvartil", + "secondQuartile": "medián", + "thirdQuartile": "třetí kvartil", "you": "vy", "resolutionDescriptionBinary": "Došlo k tomuto?", "resolutionDescriptionContinuous": "Jaká byla nakonec hodnota?", @@ -583,6 +583,7 @@ "cmmButton": "Změnil jsem názor", "cmmUpdateButton": "Aktualizovat", "cmmUpdatePredictionLink": "Aktualizovat vaši předpověď?", + "updateYourPrediction": "Aktualizujte svou předpověď", "democrat": "demokrat", "republican": "republikán", "numVotes": "{num} hlasů", @@ -722,5 +723,20 @@ "othersCount": "{count} ostatní", "selectAll": "vybrat vše", "deselectAll": "zrušit výběr všech", - "forecastDataIsEmpty": "Údaje o prognóze jsou prázdné" + "forecastDataIsEmpty": "Údaje o prognóze jsou prázdné", + "me": "mě", + "tournamentShowPostsToMainFeed": "Zobrazit turnajové příspěvky v hlavním kanálu", + "tournamentHidePostsToMainFeed": "Skrýt turnajové příspěvky v hlavním kanálu", + "forecastDisclaimer": "Na základě {predictionCount} předpovědí od {forecasterCount} prognostiků", + "embedCodeSnippet": "K vložení této stránky na svou vlastní webovou stránku můžete použít níže uvedený úryvek kódu. Výšku a šířku můžete změnit podle svých potřeb.", + "embedThisPage": "vložit tuto stránku", + "selectATheme": "vyberte téma", + "selectAGraphZoom": "Vyberte přiblížení grafu", + "light": "světlo", + "dark": "tmavý", + "all": "vše", + "2m": "2m", + "1w": "1t", + "1d": "1d" + } diff --git a/front_end/messages/en.json b/front_end/messages/en.json index 3c86bc35ca..d0fa107761 100644 --- a/front_end/messages/en.json +++ b/front_end/messages/en.json @@ -19,7 +19,7 @@ "remove": "remove", "removed": "removed", "reply": "Reply", - "cancelButton": "Cancel", + "cancel": "Cancel", "edit": "Edit", "report": "Report", "delete": "Delete", @@ -68,9 +68,9 @@ "unweighted": "Unweighted", "metaculus": "Metaculus", "community": "community", - "firstQuartileLabel": "lower 25%", - "secondQuartileLabel": "median", - "thirdQuartileLabel": "upper 75%", + "firstQuartile": "lower 25%", + "secondQuartile": "median", + "thirdQuartile": "upper 75%", "you": "you", "resolutionDescriptionBinary": "Did this actually happen?", "resolutionDescriptionMultipleChoice": "Which of these actually happened?", @@ -585,6 +585,7 @@ "cmmButton": "Changed my mind", "cmmUpdateButton": "Update", "cmmUpdatePredictionLink": "Update your prediction?", + "updateYourPrediction": "Update your prediction", "democrat": "democrat", "republican": "republican", "numVotes": "{num} votes", @@ -736,5 +737,18 @@ "forecastDataIsEmpty": "Forecast data is empty", "createdByUserOnDate": "Created by {user} on {date}", "tournamentShowPostsToMainFeed": "Show tournament posts in main feed", - "tournamentHidePostsToMainFeed": "Hide tournament posts in main feed" + "tournamentHidePostsToMainFeed": "Hide tournament posts in main feed", + "me": "me", + "forecastDisclaimer": "Based on {predictionCount} predictions by {forecasterCount} forecasters", + "embedCodeSnippet": "You can use the below code snippet to embed this page on your own webpage. Feel free to change the height and width to suit your needs.", + "embedThisPage": "embed this page", + "selectATheme": "Select a theme", + "selectAGraphZoom": "Select a graph zoom", + "light": "light", + "dark": "dark", + "all": "all", + "2m": "2m", + "1w": "1w", + "1d": "1d", + "errorDeletingComment": "error deleting comment:" } diff --git a/front_end/messages/zh.json b/front_end/messages/zh.json index 85d710361e..fe8506f332 100644 --- a/front_end/messages/zh.json +++ b/front_end/messages/zh.json @@ -17,7 +17,7 @@ "addComponentButton": "添加組件", "adminEditButton": "管理員編輯", "reply": "回覆", - "cancelButton": "取消", + "cancel": "取消", "edit": "編輯", "report": "舉報", "delete": "刪除", @@ -66,9 +66,9 @@ "unweighted": "未加權", "metaculus": "Metaculus", "community": "社區", - "firstQuartileLabel": "下四分位數 25%", - "secondQuartileLabel": "中位數", - "thirdQuartileLabel": "上四分位數 75%", + "firstQuartile": "下四分位數 25%", + "secondQuartile": "中位數", + "thirdQuartile": "上四分位數 75%", "you": "你", "resolutionDescriptionBinary": "這實際上發生了嗎?", "resolutionDescriptionMultipleChoice": "這些中哪個實際發生了?", @@ -574,6 +574,7 @@ "cmmButton": "改變主意", "cmmUpdateButton": "更新", "cmmUpdatePredictionLink": "更新您的預測?", + "updateYourPrediction": "更新您的預測", "democrat": "民主黨", "republican": "共和黨", "numVotes": "{num} 票", @@ -713,5 +714,19 @@ "othersCount": "{count}其他", "selectAll": "選擇全部", "deselectAll": "取消全選", - "forecastDataIsEmpty": "預測資料為空" + "forecastDataIsEmpty": "預測資料為空", + "tournamentShowPostsToMainFeed": "在主提要中顯示錦標賽貼文", + "tournamentHidePostsToMainFeed": "隱藏主提要中的錦標賽貼文", + "me": "我", + "forecastDisclaimer": "基於 {forecasterCount} 預測者的 {predictionCount} 預測", + "embedCodeSnippet": "您可以使用下面的程式碼片段將此頁面嵌入到您自己的網頁上。請隨意更改高度和寬度以滿足您的需求。", + "embedThisPage": "嵌入此頁面", + "selectATheme": "選擇一個主題", + "selectAGraphZoom": "選擇圖形縮放", + "light": "光", + "dark": "暗", + "all": "全部", + "2m": "2月", + "1w": "1週", + "1d": "1日" } diff --git a/front_end/package-lock.json b/front_end/package-lock.json index d59b9330ec..fc7cb2815f 100644 --- a/front_end/package-lock.json +++ b/front_end/package-lock.json @@ -21,6 +21,12 @@ "@mdxeditor/editor": "^3.4.2", "@radix-ui/react-popover": "^1.1.1", "@tailwindcss/container-queries": "^0.1.1", + "@types/d3": "^7.4.3", + "@types/lodash": "^4.17.7", + "@types/node": "^20", + "@types/react": "^18", + "@types/react-dom": "^18", + "@types/react-slider": "^1.3.6", "axios": "^1.7.2", "better-react-mathjax": "^2.0.3", "classnames": "^2.5.1", @@ -51,12 +57,6 @@ "zod": "^3.23.8" }, "devDependencies": { - "@types/d3": "^7.4.3", - "@types/lodash": "^4.17.7", - "@types/node": "^20", - "@types/react": "^18", - "@types/react-dom": "^18", - "@types/react-slider": "^1.3.6", "eslint": "^8.57.0", "eslint-config-next": "14.2.3", "eslint-config-prettier": "^9.1.0", @@ -2682,7 +2682,6 @@ "version": "7.4.3", "resolved": "https://registry.npmjs.org/@types/d3/-/d3-7.4.3.tgz", "integrity": "sha512-lZXZ9ckh5R8uiFVt8ogUNf+pIrK4EsWrx2Np75WvF/eTpJ0FMHNhjXk8CKEx/+gpHbNQyJWehbFaTvqmHWB3ww==", - "dev": true, "dependencies": { "@types/d3-array": "*", "@types/d3-axis": "*", @@ -2725,7 +2724,6 @@ "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/d3-axis/-/d3-axis-3.0.6.tgz", "integrity": "sha512-pYeijfZuBd87T0hGn0FO1vQ/cgLk6E1ALJjfkC0oJ8cbwkZl3TpgS8bVBLZN+2jjGgg38epgxb2zmoGtSfvgMw==", - "dev": true, "dependencies": { "@types/d3-selection": "*" } @@ -2734,7 +2732,6 @@ "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/d3-brush/-/d3-brush-3.0.6.tgz", "integrity": "sha512-nH60IZNNxEcrh6L1ZSMNA28rj27ut/2ZmI3r96Zd+1jrZD++zD3LsMIjWlvg4AYrHn/Pqz4CF3veCxGjtbqt7A==", - "dev": true, "dependencies": { "@types/d3-selection": "*" } @@ -2742,8 +2739,7 @@ "node_modules/@types/d3-chord": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/d3-chord/-/d3-chord-3.0.6.tgz", - "integrity": "sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==", - "dev": true + "integrity": "sha512-LFYWWd8nwfwEmTZG9PfQxd17HbNPksHBiJHaKuY1XeqscXacsS2tyoo6OdRsjf+NQYeB6XrNL3a25E3gH69lcg==" }, "node_modules/@types/d3-color": { "version": "3.1.3", @@ -2754,7 +2750,6 @@ "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/d3-contour/-/d3-contour-3.0.6.tgz", "integrity": "sha512-BjzLgXGnCWjUSYGfH1cpdo41/hgdWETu4YxpezoztawmqsvCeep+8QGfiY6YbDvfgHz/DkjeIkkZVJavB4a3rg==", - "dev": true, "dependencies": { "@types/d3-array": "*", "@types/geojson": "*" @@ -2763,20 +2758,17 @@ "node_modules/@types/d3-delaunay": { "version": "6.0.4", "resolved": "https://registry.npmjs.org/@types/d3-delaunay/-/d3-delaunay-6.0.4.tgz", - "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==", - "dev": true + "integrity": "sha512-ZMaSKu4THYCU6sV64Lhg6qjf1orxBthaC161plr5KuPHo3CNm8DTHiLw/5Eq2b6TsNP0W0iJrUOFscY6Q450Hw==" }, "node_modules/@types/d3-dispatch": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/d3-dispatch/-/d3-dispatch-3.0.6.tgz", - "integrity": "sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==", - "dev": true + "integrity": "sha512-4fvZhzMeeuBJYZXRXrRIQnvUYfyXwYmLsdiN7XXmVNQKKw1cM8a5WdID0g1hVFZDqT9ZqZEY5pD44p24VS7iZQ==" }, "node_modules/@types/d3-drag": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/@types/d3-drag/-/d3-drag-3.0.7.tgz", "integrity": "sha512-HE3jVKlzU9AaMazNufooRJ5ZpWmLIoc90A37WU2JMmeq28w1FQqCZswHZ3xR+SuxYftzHq6WU6KJHvqxKzTxxQ==", - "dev": true, "dependencies": { "@types/d3-selection": "*" } @@ -2784,8 +2776,7 @@ "node_modules/@types/d3-dsv": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/@types/d3-dsv/-/d3-dsv-3.0.7.tgz", - "integrity": "sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==", - "dev": true + "integrity": "sha512-n6QBF9/+XASqcKK6waudgL0pf/S5XHPPI8APyMLLUHd8NqouBGLsU8MgtO7NINGtPBtk9Kko/W4ea0oAspwh9g==" }, "node_modules/@types/d3-ease": { "version": "3.0.2", @@ -2796,7 +2787,6 @@ "version": "3.0.7", "resolved": "https://registry.npmjs.org/@types/d3-fetch/-/d3-fetch-3.0.7.tgz", "integrity": "sha512-fTAfNmxSb9SOWNB9IoG5c8Hg6R+AzUHDRlsXsDZsNp6sxAEOP0tkP3gKkNSO/qmHPoBFTxNrjDprVHDQDvo5aA==", - "dev": true, "dependencies": { "@types/d3-dsv": "*" } @@ -2804,20 +2794,17 @@ "node_modules/@types/d3-force": { "version": "3.0.9", "resolved": "https://registry.npmjs.org/@types/d3-force/-/d3-force-3.0.9.tgz", - "integrity": "sha512-IKtvyFdb4Q0LWna6ymywQsEYjK/94SGhPrMfEr1TIc5OBeziTi+1jcCvttts8e0UWZIxpasjnQk9MNk/3iS+kA==", - "dev": true + "integrity": "sha512-IKtvyFdb4Q0LWna6ymywQsEYjK/94SGhPrMfEr1TIc5OBeziTi+1jcCvttts8e0UWZIxpasjnQk9MNk/3iS+kA==" }, "node_modules/@types/d3-format": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/@types/d3-format/-/d3-format-3.0.4.tgz", - "integrity": "sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==", - "dev": true + "integrity": "sha512-fALi2aI6shfg7vM5KiR1wNJnZ7r6UuggVqtDA+xiEdPZQwy/trcQaHnwShLuLdta2rTymCNpxYTiMZX/e09F4g==" }, "node_modules/@types/d3-geo": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/@types/d3-geo/-/d3-geo-3.1.0.tgz", "integrity": "sha512-856sckF0oP/diXtS4jNsiQw/UuK5fQG8l/a9VVLeSouf1/PPbBE1i1W852zVwKwYCBkFJJB7nCFTbk6UMEXBOQ==", - "dev": true, "dependencies": { "@types/geojson": "*" } @@ -2825,8 +2812,7 @@ "node_modules/@types/d3-hierarchy": { "version": "3.1.7", "resolved": "https://registry.npmjs.org/@types/d3-hierarchy/-/d3-hierarchy-3.1.7.tgz", - "integrity": "sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg==", - "dev": true + "integrity": "sha512-tJFtNoYBtRtkNysX1Xq4sxtjK8YgoWUNpIiUee0/jHGRwqvzYxkq0hGVbbOGSz+JgFxxRu4K8nb3YpG3CMARtg==" }, "node_modules/@types/d3-interpolate": { "version": "3.0.4", @@ -2844,20 +2830,17 @@ "node_modules/@types/d3-polygon": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/@types/d3-polygon/-/d3-polygon-3.0.2.tgz", - "integrity": "sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==", - "dev": true + "integrity": "sha512-ZuWOtMaHCkN9xoeEMr1ubW2nGWsp4nIql+OPQRstu4ypeZ+zk3YKqQT0CXVe/PYqrKpZAi+J9mTs05TKwjXSRA==" }, "node_modules/@types/d3-quadtree": { "version": "3.0.6", "resolved": "https://registry.npmjs.org/@types/d3-quadtree/-/d3-quadtree-3.0.6.tgz", - "integrity": "sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==", - "dev": true + "integrity": "sha512-oUzyO1/Zm6rsxKRHA1vH0NEDG58HrT5icx/azi9MF1TWdtttWl0UIUsjEQBBh+SIkrpd21ZjEv7ptxWys1ncsg==" }, "node_modules/@types/d3-random": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/d3-random/-/d3-random-3.0.3.tgz", - "integrity": "sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==", - "dev": true + "integrity": "sha512-Imagg1vJ3y76Y2ea0871wpabqp613+8/r0mCLEBfdtqC7xMSfj9idOnmBYyMoULfHePJyxMAw3nWhJxzc+LFwQ==" }, "node_modules/@types/d3-scale": { "version": "4.0.8", @@ -2870,14 +2853,12 @@ "node_modules/@types/d3-scale-chromatic": { "version": "3.0.3", "resolved": "https://registry.npmjs.org/@types/d3-scale-chromatic/-/d3-scale-chromatic-3.0.3.tgz", - "integrity": "sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==", - "dev": true + "integrity": "sha512-laXM4+1o5ImZv3RpFAsTRn3TEkzqkytiOY0Dz0sq5cnd1dtNlk6sHLon4OvqaiJb28T0S/TdsBI3Sjsy+keJrw==" }, "node_modules/@types/d3-selection": { "version": "3.0.10", "resolved": "https://registry.npmjs.org/@types/d3-selection/-/d3-selection-3.0.10.tgz", - "integrity": "sha512-cuHoUgS/V3hLdjJOLTT691+G2QoqAjCVLmr4kJXR4ha56w1Zdu8UUQ5TxLRqudgNjwXeQxKMq4j+lyf9sWuslg==", - "dev": true + "integrity": "sha512-cuHoUgS/V3hLdjJOLTT691+G2QoqAjCVLmr4kJXR4ha56w1Zdu8UUQ5TxLRqudgNjwXeQxKMq4j+lyf9sWuslg==" }, "node_modules/@types/d3-shape": { "version": "3.1.6", @@ -2895,8 +2876,7 @@ "node_modules/@types/d3-time-format": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/@types/d3-time-format/-/d3-time-format-4.0.3.tgz", - "integrity": "sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==", - "dev": true + "integrity": "sha512-5xg9rC+wWL8kdDj153qZcsJ0FWiFt0J5RB6LYUNZjwSnesfblqrI/bJ1wBdJ8OQfncgbJG5+2F+qfqnqyzYxyg==" }, "node_modules/@types/d3-timer": { "version": "3.0.2", @@ -2907,7 +2887,6 @@ "version": "3.0.8", "resolved": "https://registry.npmjs.org/@types/d3-transition/-/d3-transition-3.0.8.tgz", "integrity": "sha512-ew63aJfQ/ms7QQ4X7pk5NxQ9fZH/z+i24ZfJ6tJSfqxJMrYLiK01EAs2/Rtw/JreGUsS3pLPNV644qXFGnoZNQ==", - "dev": true, "dependencies": { "@types/d3-selection": "*" } @@ -2916,7 +2895,6 @@ "version": "3.0.8", "resolved": "https://registry.npmjs.org/@types/d3-zoom/-/d3-zoom-3.0.8.tgz", "integrity": "sha512-iqMC4/YlFCSlO8+2Ii1GGGliCAY4XdeG748w5vQUbevlbDu0zSjH/+jojorQVBK/se0j6DUFNPBGSqD3YWYnDw==", - "dev": true, "dependencies": { "@types/d3-interpolate": "*", "@types/d3-selection": "*" @@ -2946,8 +2924,7 @@ "node_modules/@types/geojson": { "version": "7946.0.14", "resolved": "https://registry.npmjs.org/@types/geojson/-/geojson-7946.0.14.tgz", - "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==", - "dev": true + "integrity": "sha512-WCfD5Ht3ZesJUsONdhvm84dmzWOiOzOAqOncN0++w0lBw1o8OuDNJF2McvvCef/yBqb/HYRahp1BYtODFQ8bRg==" }, "node_modules/@types/hast": { "version": "3.0.4", @@ -2974,8 +2951,7 @@ "node_modules/@types/lodash": { "version": "4.17.7", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.7.tgz", - "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==", - "dev": true + "integrity": "sha512-8wTvZawATi/lsmNu10/j2hk1KEP0IvjubqPE3cu1Xz7xfXXt5oCq3SNUz4fMIP4XGF9Ky+Ue2tBA3hcS7LSBlA==" }, "node_modules/@types/mdast": { "version": "4.0.4", @@ -3001,14 +2977,12 @@ "node_modules/@types/prop-types": { "version": "15.7.12", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", - "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==", - "devOptional": true + "integrity": "sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==" }, "node_modules/@types/react": { "version": "18.3.3", "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", - "devOptional": true, "dependencies": { "@types/prop-types": "*", "csstype": "^3.0.2" @@ -3018,7 +2992,6 @@ "version": "18.3.0", "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.0.tgz", "integrity": "sha512-EhwApuTmMBmXuFOikhQLIBUn6uFg81SwLMOAUgodJF14SOBOCMdU04gDoYi0WOJJHD144TL32z4yDqCW3dnkQg==", - "devOptional": true, "dependencies": { "@types/react": "*" } @@ -3027,7 +3000,6 @@ "version": "1.3.6", "resolved": "https://registry.npmjs.org/@types/react-slider/-/react-slider-1.3.6.tgz", "integrity": "sha512-RS8XN5O159YQ6tu3tGZIQz1/9StMLTg/FCIPxwqh2gwVixJnlfIodtVx+fpXVMZHe7A58lAX1Q4XTgAGOQaCQg==", - "dev": true, "dependencies": { "@types/react": "*" } diff --git a/front_end/src/app/(main)/questions/[id]/components/choices_tooltip.tsx b/front_end/src/app/(main)/questions/[id]/components/choices_tooltip.tsx index 120e1af772..f06d9cb25e 100644 --- a/front_end/src/app/(main)/questions/[id]/components/choices_tooltip.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/choices_tooltip.tsx @@ -4,6 +4,7 @@ import { FC } from "react"; import ChoiceIcon from "@/components/choice_icon"; import { ChoiceTooltipItem } from "@/types/choices"; +import { useTranslations } from "next-intl"; type Props = { date: string; @@ -12,8 +13,10 @@ type Props = { }; const ChoicesTooltip: FC = ({ date, choices, userChoices }) => { + const t = useTranslations() const containUserChoices = userChoices && !userChoices.every((choice) => choice.valueLabel === "?"); + return ( @@ -29,8 +32,8 @@ const ChoicesTooltip: FC = ({ date, choices, userChoices }) => { /> {containUserChoices && ( - )} diff --git a/front_end/src/app/(main)/questions/[id]/components/detailed_group_card/binary_group_chart.tsx b/front_end/src/app/(main)/questions/[id]/components/detailed_group_card/binary_group_chart.tsx index 85f833e186..9309a4c52e 100644 --- a/front_end/src/app/(main)/questions/[id]/components/detailed_group_card/binary_group_chart.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/detailed_group_card/binary_group_chart.tsx @@ -121,7 +121,7 @@ const BinaryGroupChart: FC = ({ const tooltipUserChoices = useMemo( () => - userForecasts === undefined + userForecasts == null ? [] : userForecasts?.map( ({ choice, values, color, timestamps: optionTimestamps }) => { diff --git a/front_end/src/app/(main)/questions/[id]/components/forecast_maker/numeric_table.tsx b/front_end/src/app/(main)/questions/[id]/components/forecast_maker/numeric_table.tsx index c28f137f22..9c4196adb6 100644 --- a/front_end/src/app/(main)/questions/[id]/components/forecast_maker/numeric_table.tsx +++ b/front_end/src/app/(main)/questions/[id]/components/forecast_maker/numeric_table.tsx @@ -1,10 +1,15 @@ import React, { FC } from "react"; -import { Bounds, Quartiles, Question } from "@/types/question"; +import { + Bounds, + Quartiles, + QuestionWithNumericForecasts, +} from "@/types/question"; import { getDisplayValue } from "@/utils/charts"; +import { useTranslations } from "next-intl"; type Props = { - question: Question; + question: QuestionWithNumericForecasts; userBounds?: Bounds; userQuartiles?: Quartiles; communityBounds?: Bounds; @@ -24,6 +29,8 @@ const NumericForecastTable: FC = ({ hasUserForecast, isDirty, }) => { + const t = useTranslations(); + return ( <>
@@ -31,54 +38,71 @@ const NumericForecastTable: FC = ({ {withUserQuartiles && ( <>
- My Prediction + {t("myPrediction")}
)} - Community + {t("community")}
-
mass below lower bound
-
lower 25%
-
median
-
upper 75%
-
mass above upper bound
+ {question.open_lower_bound && ( +
{"<"}{question.scaling.range_min}
+ )} +
{t("firstQuartile")}
+
{t("secondQuartile")}
+
{t("thirdQuartile")}
+ {question.open_upper_bound && ( +
{">"}{question.scaling.range_max}
+ )}
{withUserQuartiles && (
{isDirty || hasUserForecast ? ( <> -
- {userBounds && (userBounds.belowLower * 100).toFixed(1)}% -
+ {question.open_lower_bound && ( +
+ {userBounds && (userBounds.belowLower * 100).toFixed(1)}% +
+ )}
{getDisplayValue(userQuartiles?.lower25, question)}
{getDisplayValue(userQuartiles?.median, question)}
{getDisplayValue(userQuartiles?.upper75, question)}
-
{(userBounds!.aboveUpper * 100).toFixed(1)}%
+ {question.open_upper_bound && ( +
{(userBounds!.aboveUpper * 100).toFixed(1)}%
+ )} ) : ( <> - {[...Array(5)].map((_, i) => { + {question.open_lower_bound &&
...
} + {[...Array(3)].map((_, i) => { return
...
; })} + {question.open_lower_bound &&
...
} )}
)}
-
- {communityBounds && (communityBounds.belowLower * 100).toFixed(1)}% -
+ {question.open_lower_bound && ( +
+ {communityBounds && (communityBounds.belowLower * 100).toFixed(1)} + % +
+ )}
{getDisplayValue(communityQuartiles?.lower25, question)}
{getDisplayValue(communityQuartiles?.median, question)}
{getDisplayValue(communityQuartiles?.upper75, question)}
-
- {communityBounds && (communityBounds!.aboveUpper * 100).toFixed(1)}% -
+ {question.open_upper_bound && ( +
+ {communityBounds && + (communityBounds!.aboveUpper * 100).toFixed(1)} + % +
+ )}
diff --git a/front_end/src/app/embed/questions/[id]/page.tsx b/front_end/src/app/embed/questions/[id]/page.tsx index 646ce9a6b6..2fcd99e7b5 100644 --- a/front_end/src/app/embed/questions/[id]/page.tsx +++ b/front_end/src/app/embed/questions/[id]/page.tsx @@ -10,7 +10,7 @@ import PostsApi from "@/services/posts"; import { TimelineChartZoomOption } from "@/types/charts"; import { SearchParams } from "@/types/navigation"; import "./styles.scss"; -import { PostWithForecasts } from "@/types/post"; +import { getTranslations } from "next-intl/server"; export default async function GenerateQuestionPreview({ params, @@ -19,6 +19,7 @@ export default async function GenerateQuestionPreview({ params: { id: number }; searchParams: SearchParams; }) { + const t = await getTranslations() const post = await PostsApi.getPost(params.id); if (!post) { return null; @@ -59,15 +60,14 @@ export default async function GenerateQuestionPreview({ />

- Based on {post.forecasts_count ?? 0} predictions by{" "} - {post.nr_forecasters ?? 0} forecasters + {t("forecastDisclaimer", { predictionCount: post.forecasts_count ?? 0, forecasterCount: post.nr_forecasters })}

- Metaculus + {t("metaculus")}
diff --git a/front_end/src/components/charts/histogram.tsx b/front_end/src/components/charts/histogram.tsx index 34b12d322f..e862c22f4f 100644 --- a/front_end/src/components/charts/histogram.tsx +++ b/front_end/src/components/charts/histogram.tsx @@ -94,8 +94,8 @@ const Histogram: React.FC = ({ ), stroke: getThemeColor( color === "blue" - ? METAC_COLORS["conditional-blue"]["500"] - : METAC_COLORS["conditional-green"]["500"] + ? METAC_COLORS["conditional-blue"]["700"] + : METAC_COLORS["conditional-green"]["700"] ), strokeWidth: 1, }, diff --git a/front_end/src/components/charts/multiple_choice_chart.tsx b/front_end/src/components/charts/multiple_choice_chart.tsx index b76c68fba3..d3facfed22 100644 --- a/front_end/src/components/charts/multiple_choice_chart.tsx +++ b/front_end/src/components/charts/multiple_choice_chart.tsx @@ -1,5 +1,5 @@ "use client"; -import { fromUnixTime } from "date-fns"; + import { isNil, merge } from "lodash"; import React, { FC, memo, useEffect, useMemo, useState } from "react"; import { @@ -41,6 +41,7 @@ import { import ChartContainer from "./primitives/chart_container"; import ChartCursorLabel from "./primitives/chart_cursor_label"; import XTickLabel from "./primitives/x_tick_label"; +import { useTranslations } from "next-intl"; type Props = { timestamps: number[]; @@ -67,6 +68,7 @@ const MultipleChoiceChart: FC = ({ extraTheme, userForecasts, }) => { + const t = useTranslations(); const { ref: chartContainerRef, width: chartWidth, @@ -118,7 +120,7 @@ const MultipleChoiceChart: FC = ({ cursorLabel={({ datum }: VictoryLabelProps) => { if (datum) { return datum.x === defaultCursor - ? "now" + ? t("now") : xScale.cursorFormat?.(datum.x) ?? xScale.tickFormat(datum.x); } }} diff --git a/front_end/src/components/comment_feed/comment.tsx b/front_end/src/components/comment_feed/comment.tsx index 60eabfea3d..3928aaa69a 100644 --- a/front_end/src/components/comment_feed/comment.tsx +++ b/front_end/src/components/comment_feed/comment.tsx @@ -33,14 +33,6 @@ import IncludedForecast from "./included_forecast"; import { SortOption, sortComments } from "."; -const copyToClipboard = async (text: string) => { - try { - await navigator.clipboard.writeText(text); - } catch (err) { - console.error("Failed to copy text: ", err); - } -}; - type CommentChildrenTreeProps = { commentChildren: CommentType[]; permissions: CommentPermissions; @@ -194,6 +186,14 @@ const Comment: FC = ({ } }; + const copyToClipboard = async (text: string) => { + try { + await navigator.clipboard.writeText(text); + } catch (err) { + console.error(t("failedToCopyText"), err); + } + }; + const menuItems: MenuItemProps[] = [ { hidden: !isMobileScreen || !isCmmButtonVisible, @@ -363,7 +363,7 @@ const Comment: FC = ({ author: user!.id, }); if (response && "errors" in response) { - console.error("Error deleting comment:", response.errors); + console.error(t("errorDeletingComment"), response.errors); } else { setIsEditing(false); } @@ -402,7 +402,7 @@ const Comment: FC = ({ }} > - Cancel + {t("cancel")} ) : (
- Me + + {t("me")}