Modrinth-ChineseTranslated

一个汉化Modrinth网页的的脚本,将 Modrinth 网站的内容翻译成中文。

  1. // ==UserScript==
  2. // @name Modrinth-ChineseTranslated
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.2.0
  5. // @description 一个汉化Modrinth网页的的脚本,将 Modrinth 网站的内容翻译成中文。
  6. // @author YlovexLN
  7. // @match https://modrinth.com/*
  8. // @grant none
  9. // @license GPL-3.0
  10. // @supportURL https://github.com/YlovexLN/Modrinth-ChineseTranslated/issues
  11. // ==/UserScript==
  12.  
  13. (function () {
  14. "use strict";
  15.  
  16. // 翻译词典
  17. const translations = {
  18. "Discover content": "发现内容",
  19. "Host a server": "托管服务器",
  20. "Modrinth App": "Modrinth 应用",
  21. "New project": "新建项目",
  22. "New collection": "新建收藏夹",
  23. "New organization": "新建组织",
  24. "The place for Minecraft mods plugins data packs shaders resource packs modpacks":
  25. "Minecraft 模组、插件、数据包、光影包、资源包和模组包的家园",
  26. Mods: "模组",
  27. mods: "模组",
  28. Plugins: "插件",
  29. plugins: "插件",
  30. "Data Packs": "数据包",
  31. "data packs": "数据包",
  32. Shaders: "光影包",
  33. shaders: "光影包",
  34. "resource packs": "资源包",
  35. "Resource Packs": "资源包",
  36. Modpacks: "模组包",
  37. modpacks: "模组包",
  38. Servers: "服务器",
  39. servers: "服务器",
  40. "Upgrade to Modrinth+": "升级到 Modrinth+",
  41. "Saved projects": "保存的项目",
  42. "My servers": "我的服务器",
  43. Notifications: "通知",
  44. Revenue: "收入",
  45. Analytics: "分析",
  46. "Sign out": "登出",
  47. "Discover, play, and share Minecraft content through our open-source platform built for the community.":
  48. "通过我们为社区打造的开源平台发现、游玩和分享 Minecraft 内容。",
  49. "Discover mods": "发现模组",
  50. "Go to dashboard": "前往仪表盘",
  51. "For Players": "面向玩家",
  52. "Discover over 50,000 creations": "发现超过 50,000 个创作",
  53. "From magical biomes to cursed dungeons, you can be sure to find content to bring your gameplay to the next level.":
  54. "从魔法生物群系到诅咒的地牢,你肯定能找到能提升游戏体验的内容。",
  55. "Find what you want, quickly and easily": "快速轻松地找到你想找的内容",
  56. "Modrinth's lightning-fast search and powerful filters let you find what you want as you type.":
  57. "Modrinth 的超快搜索和强大的筛选功能让你在输入时就能找到想要的内容。",
  58. "Sort by": "排序",
  59. Relevance: "相关性",
  60. Downloads: "下载量",
  61. Follows: "关注数",
  62. Updated: "更新时间",
  63. Newest: "最新",
  64. "Follow projects you love": "关注你喜欢的项目",
  65. "Get notified every time your favorite projects update and stay in the loop":
  66. "每次你关注的项目更新时都会收到通知,不错过任何动态",
  67. "Give an online home to your creations and reach a massive audience of dedicated players":
  68. "为你创作的内容提供在线家园,并触及大量忠实玩家",
  69. "Play with your favorite launcher": "使用你喜爱的启动器游玩",
  70. "Modrinth's open-source API lets launchers add deep integration with Modrinth. You can use Modrinth through":
  71. "Modrinth 的开源 API 让启动器能够深度集成 Modrinth。你可以通过",
  72. "our own app": "我们自己的应用程序",
  73. "and some of the most popular launchers like ATLauncher, MultiMC, and Prism Launcher.":
  74. "和一些最受欢迎的启动器(如 ATLauncher、MultiMC 和 Prism Launcher)使用 Modrinth。",
  75. "For Creators": "创作者专区",
  76. "Share your content with the world": "与世界分享你的内容",
  77. "Give an online home to your creations and reach a massive audience of dedicated players":
  78. "为你创作的内容提供在线家园,并触及大量忠实玩家",
  79. Discovery: "发现",
  80. "Get your project discovered by thousands of users through search, our home page, Discord server, and more ways to come in the future!":
  81. "通过搜索、我们的首页、Discord 服务器以及未来更多方式,让你的项目被成千上万的用户发现!",
  82. "Team Management": "团队管理",
  83. "Invite your teammates and manage roles and permissions with ease":
  84. "轻松邀请队友并管理角色和权限",
  85. Monetization: " 收益",
  86. "Get paid ad revenue from your project pages and withdraw your funds at any time":
  87. "从你的项目页面获得广告收入,并随时提现",
  88. "Diverse Ecosystem": "多样化的生态系统",
  89. "Integrate with your build tools through Minotaur for automatic uploads right when you release a new version":
  90. "通过 Minotaur 与构建工具集成,实现在发布新版本时自动上传",
  91. "Data and Statistics": "数据和统计",
  92. "Get detailed reports on page views, download counts, and revenue":
  93. "获取详细的页面浏览量、下载次数和收入报告",
  94. "Constantly Evolving": "不断进化",
  95. "Get the best modding experience possible with constant updates from the Modrinth team":
  96. "通过 Modrinth 团队的持续更新,获得最佳的模组制作体验",
  97. "Read more about": "了解更多关于",
  98. "Visit the blog": "访问博客",
  99. "Modrinth is ": "Modrinth 是 ",
  100. "open source": "开源的",
  101. ".": "。",
  102. Company: "公司",
  103. Terms: "条款",
  104. Privacy: "隐私",
  105. Rules: "规则",
  106. Careers: "职位",
  107. Resources: "资源",
  108. Support: "支持",
  109. About: "关于",
  110. Blog: "博客",
  111. Docs: "文档",
  112. Status: "状态",
  113. "Rewards Program": "奖励计划",
  114. Products: "产品",
  115. "Modrinth Servers": "Modrinth 服务器",
  116. "Help Center": "帮助中心",
  117. Translate: "翻译",
  118. "Report issues": "报告问题",
  119. "API documentation": "API 文档",
  120. Legal: "法律",
  121. "Content Rules": "内容规则",
  122. "Terms of Use": "使用条款",
  123. "Security Notice": "安全声明",
  124. Interact: "互动",
  125. "X (Twitter)": "X (推特)",
  126. "Get Modrinth App": "获取 Modrinth 应用",
  127. "Sign in": "登录(不可用)",
  128. "Sign up": "注册(不可用)",
  129. "Sign in with": "使用以下方式登录(不可用)",
  130. "Or use a password": "或使用密码",
  131. "Create an account": "创建账户",
  132. "Enter two-factor code": "输入两步验证码",
  133. "Please enter a two-factor code to proceed.": "请输入两步验证码以继续。",
  134. "Change theme": "更改主题",
  135. "NOT AN OFFICIAL MINECRAFT SERVICE. NOT APPROVED BY OR ASSOCIATED WITH MOJANG OR MICROSOFT.":
  136. "这不是官方的 Minecraft 服务。未经 Mojang 或 Microsoft 批准或关联。",
  137. "Join the conversation": "加入讨论",
  138. "Loading...": "加载中...",
  139. "No results found": "未找到结果",
  140. Home: "首页",
  141. Login: "登录(不可用)",
  142. Register: "注册(不可用)",
  143. Profile: "个人资料",
  144. Settings: "设置",
  145. Logout: "登出",
  146. Dashboard: "仪表盘",
  147. "My Projects": "我的项目",
  148. "My Organizations": "我的组织",
  149. "My Collections": "我的收藏夹",
  150. "Create Project": "创建项目",
  151. "Create Collection": "创建收藏夹",
  152. "Create Organization": "创建组织",
  153. "Latest News": "最新新闻",
  154. Featured: "精选",
  155. "Support us": "支持我们",
  156. "Help & Support": "帮助和支持",
  157. Documentation: "文档",
  158. "Terms of Service": "服务条款",
  159. "Privacy Policy": "隐私政策",
  160. Categories: "分类",
  161. Trending: "趋势",
  162. "Featured Packs": "精选包",
  163. "Recent Activity": "最近活动",
  164. Community: "社区",
  165. Popular: "流行",
  166. "Search results for": "搜索结果",
  167. Submit: "提交",
  168. Apply: "应用",
  169. Cancel: "取消",
  170. Username: "用户名",
  171. Password: "密码",
  172. "Confirm Password": "确认密码",
  173. "Submit your mod": "提交你的模组",
  174. "Edit Project": "编辑项目",
  175. "Delete Project": "删除项目",
  176. "Project Settings": "项目设置",
  177. "Manage Organization": "管理组织",
  178. "Your Projects": "你的项目",
  179. "Your Collections": "你的收藏夹",
  180. "Your Organizations": "你的组织",
  181. "Add New Mod": "添加新模组",
  182. "Add New Collection": "添加新收藏夹",
  183. "Add New Organization": "添加新组织",
  184. "Minecraft Version": "Minecraft 版本",
  185. "Game Version": "游戏版本",
  186. "Choose File": "选择文件",
  187. Upload: "上传",
  188. Download: "下载",
  189. "Install Instructions": "安装说明",
  190. "Change Log": "更新日志",
  191. "Report an Issue": "报告问题",
  192. "View Project": "查看项目",
  193. "Version History": "版本历史",
  194. "Modrinth API": "Modrinth API",
  195. "About Us": "关于我们",
  196. Contact: "联系方式",
  197. Support: "支持",
  198. "API Documentation": "API 文档",
  199. "Privacy Settings": "隐私设置",
  200. "Invite a member": "邀请成员",
  201. "Manage Members": "管理成员",
  202. "Organization Settings": "组织设置",
  203. "Request Access": "请求访问",
  204. "Create New Project": "创建新项目",
  205. "Project Version": "项目版本",
  206. Resources: "资源",
  207. "Installation Instructions": "安装说明",
  208. "Review and Ratings": "评论与评分",
  209. "View Comments": "查看评论",
  210. "Add Comment": "添加评论",
  211. "Add Review": "添加评分",
  212. Approve: "批准",
  213. Reject: "拒绝",
  214. Draft: "草稿",
  215. Publish: "发布",
  216. Published: "已发布",
  217. Unpublished: "未发布",
  218. Starred: "收藏",
  219. Favorites: "收藏夹",
  220. "User Reviews": "用户评论",
  221. Developer: "开发者",
  222. Owner: "所有者",
  223. "Created by": "创建者",
  224. "Version Notes": "版本说明",
  225. "Mods and Add-ons": "模组和附加组件",
  226. Contribute: "贡献",
  227. Donate: "捐赠",
  228. "Download Now": "立即下载",
  229. "Latest Release": "最新版本",
  230. "Upcoming Updates": "即将更新",
  231. "Install Now": "立即安装",
  232. Required: "必需",
  233. Optional: "可选",
  234. "Add to Favorites": "加入收藏夹",
  235. "View Details": "查看详情",
  236. "Related Projects": "相关项目",
  237. "Related Mods": "相关模组",
  238. "View All": "查看所有",
  239. New: "新建",
  240. Version: "版本",
  241. "Link to this page": "链接到此页面",
  242. "Copy Link": "复制链接",
  243. Share: "分享",
  244. "View More": "查看更多",
  245. Back: "返回",
  246. "Go Back": "返回",
  247. Continue: "继续",
  248. Next: "下一步",
  249. Previous: "上一页",
  250. "Cancel Subscription": "取消订阅",
  251. "Manage Subscription": "管理订阅",
  252. "Subscribe Now": "立即订阅",
  253. "Notifications Settings": "通知设置",
  254. Activate: "激活",
  255. Deactivate: "停用",
  256. "Terms and Conditions": "条款与条件",
  257. "Cookies Policy": "Cookies 政策",
  258. "Privacy Preferences": "隐私偏好设置",
  259. "User Agreement": "用户协议",
  260. "Sign In": "登录(不可用)",
  261. "Sign Up": "注册(不可用)",
  262. "Forgot Password?": "忘记密码?",
  263. "Reset Password": "重置密码",
  264. "Change Email": "更改邮箱",
  265. "Change Username": "更改用户名",
  266. "Update Profile": "更新个人资料",
  267. "Account Settings": "账户设置",
  268. "Security Settings": "安全设置",
  269. "Two-factor Authentication": "两步验证",
  270. "Security Questions": "安全问题",
  271. "Session Expired": "会话过期",
  272. "Account Suspended": "账户被暂停",
  273. "Subscription Expired": "订阅已过期",
  274. "Confirm Email Address": "确认电子邮件地址",
  275. "Email Verified": "邮箱已验证",
  276. Error: "错误",
  277. Success: "成功",
  278. Warning: "警告",
  279. Information: "信息",
  280. Confirmation: "确认",
  281. "Action Required": "需要操作",
  282. Retry: "重试",
  283. Save: "保存",
  284. Edit: "编辑",
  285. Delete: "删除",
  286. Close: "关闭",
  287. Description: "描述",
  288. Tags: "标签",
  289. Comments: "评论",
  290. Reviews: "评价",
  291. Rating: "评分",
  292. Stars: "星标",
  293. Members: "成员",
  294. Projects: "项目",
  295. Collections: "收藏夹",
  296. Organizations: "组织",
  297. Followers: "关注者",
  298. Following: "正在关注",
  299. Follow: "关注",
  300. Unfollow: "取消关注",
  301. Joined: "加入日期",
  302. "Last Updated": "最后更新",
  303. License: "许可证",
  304. Permissions: "权限",
  305. Collaborators: "协作者",
  306. Admin: "管理员",
  307. Moderator: "版主",
  308. Member: "成员",
  309. Guest: "访客",
  310. Public: "公开",
  311. Private: "私有",
  312. Team: "团队",
  313. Role: "角色",
  314. Actions: "操作",
  315. Select: "选择",
  316. Filter: "筛选",
  317. Clear: "清除",
  318. All: "全部",
  319. Active: "活跃",
  320. Inactive: "不活跃",
  321. Online: "在线",
  322. Offline: "离线",
  323. Verified: "已验证",
  324. Pending: "待处理",
  325. Rejected: "已拒绝",
  326. Approved: "已批准",
  327. Blocked: "已阻止",
  328. Banned: "已封禁",
  329. Suspended: "已暂停",
  330. Disabled: "已禁用",
  331. Enabled: "已启用",
  332. Visible: "可见",
  333. Hidden: "隐藏",
  334. Open: "打开",
  335. Closed: "关闭",
  336. Locked: "锁定",
  337. Unlocked: "解锁",
  338. Allowed: "允许",
  339. Forbidden: "禁止",
  340. Granted: "授予",
  341. Revoked: "撤销",
  342. Assigned: "分配",
  343. Unassigned: "未分配",
  344. Available: "可用",
  345. Unavailable: "不可用",
  346. Installed: "已安装",
  347. "Not Installed": "未安装",
  348. Compatible: "兼容",
  349. Incompatible: "不兼容",
  350. Supported: "支持",
  351. Unsupported: "不支持",
  352. "Required Files": "必需文件",
  353. "Recommended Files": "推荐文件",
  354. "Optional Files": "可选文件",
  355. Dependencies: "依赖项",
  356. Conflict: "冲突",
  357. Changelog: "更新日志",
  358. "Read more": "阅读更多",
  359. "See all": "查看全部",
  360. "Load more": "加载更多",
  361. //Mods页面补全
  362. "75% of ad revenue goes to creators": "75% 的广告收入归创作者所有",
  363. "Support creators and Modrinth ad-free with ":
  364. "通过 Modrinth+ 无广告地支持创作者和 ",
  365. "Game version": "游戏版本",
  366. "Search...": "搜索...",
  367. "Show all versions": "显示所有版本",
  368. Loader: "加载器",
  369. "Show more": "显示更多",
  370. Adventure: "冒险",
  371. Cursed: "诅咒",
  372. Decoration: "装饰",
  373. Economy: "经济",
  374. Equipment: "装备",
  375. Food: "食物",
  376. "Game Mechanics": "游戏机制",
  377. Library: "库",
  378. Magic: "魔法",
  379. Management: "管理",
  380. Minigame: "小游戏",
  381. Mobs: "生物",
  382. Optimization: "优化",
  383. Social: "社交",
  384. Storage: "存储",
  385. Technology: "科技",
  386. Transportation: "运输",
  387. Utility: "实用工具",
  388. "World Generation": "世界生成",
  389. Environment: "环境",
  390. Client: "客户端",
  391. Server: "服务端",
  392. "Open source": "开源",
  393.  
  394. // 遍历页面内容并替换为翻译
  395. };
  396.  
  397. // 遍历页面内容并替换为翻译
  398. const translateText = (node) => {
  399. if (node.nodeType === Node.TEXT_NODE) {
  400. const originalText = node.textContent.trim();
  401. if (translations[originalText]) {
  402. node.textContent = translations[originalText];
  403. }
  404. } else if (node.nodeType === Node.ELEMENT_NODE) {
  405. // 处理 placeholder 属性
  406. if (node.hasAttribute("placeholder")) {
  407. const originalPlaceholder = node.getAttribute("placeholder").trim();
  408. if (translations[originalPlaceholder]) {
  409. node.setAttribute("placeholder", translations[originalPlaceholder]);
  410. }
  411. }
  412. // 继续遍历子节点
  413. for (let child of node.childNodes) {
  414. translateText(child);
  415. }
  416. }
  417. };
  418.  
  419. // 页面加载后开始翻译
  420. const observer = new MutationObserver(() => {
  421. translateText(document.body);
  422. fixNavTabStyle();
  423. });
  424.  
  425. // 添加导航栏样式修复函数
  426. const fixNavTabStyle = () => {
  427. const navTab = document.querySelector(".navtabs-transition");
  428. if (navTab) {
  429. navTab.style.backgroundColor = "rgb(var(--color-button-bgSelected))";
  430. navTab.style.opacity = "1";
  431. }
  432. };
  433.  
  434. observer.observe(document.body, {
  435. childList: true,
  436. subtree: true,
  437. attributes: true,
  438. attributeFilter: ["style", "class"],
  439. });
  440.  
  441. // 初次加载时执行
  442. translateText(document.body);
  443. fixNavTabStyle();
  444. })();

QingJ © 2025

镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址