SQLite 网站汉化

翻译 SQLite 网站

// ==UserScript==
// @name SQLite 网站汉化
// @namespace SQLite
// @include https://sqlite.org/*
// @grant none
// @version 1.0.2
// @author noahliu
// @description 翻译 SQLite 网站
// ==/UserScript==

var allNodes = document.body.querySelectorAll('*')

var allNodeArr = Array.from(allNodes)

var textObj = {
  "\nSmall. Fast. Reliable.":"\n轻量、快速、可靠",
  "Choose any three.\n":"Choose any three.\n",
  "Home":"首页",
  "Menu":"菜单",
  "About":"关于",
  "Documentation":"文档",
  "Download":"下载",
  "License":"授权协议",
  "Support":"支持",
  "Purchase":"套餐",
  "Search":"搜索",
  "Common Links":"快捷导航",
  "Features":"特点",
  "When to use SQLite":"何时使用SQLite",
  "Frequently Asked Questions":"常见问题",
  "Getting Started":"开始",
  "Prior Releases":"老版本",
  "SQL Syntax":"SQL 语法",
  "Pragmas":"自有语法",
  "SQL functions":"SQL 方法",
  "Date & time functions":"日期/时间方法",
  "Aggregate functions":"聚合方法",
  "Window functions":"窗口方法",
  "JSON functions":"JSON 方法",
  "C/C++ Interface Spec":"C/C++ 接口说明",
  "Introduction":"入门",
  "List of C-language APIs":"C语言API列表",
  "The TCL Interface Spec":"TCL接口说明",
  "Commit History":"提交历史",
  "Report a Bug":"报告Bug",
  "News":"新闻",
  "What Is SQLite?":"什么是SQLite呢?",
  "Latest Release":"最新版本",
  " Document Lists And Indexes": "文档目录及导航",
  "Alphabetical Listing Of All Documents": "按字母顺序排列所有文档",
  "Website Keyword Index": "网站关键词索引",
  "Permuted Title Index": "排列标题索引",
  " Overview Documents": "概述",
  "About SQLite": "关于SQlite",
  "→ \n  A high-level overview of what SQLite is and why you might be\n  interested in using it.\n": "→ 高级概述SQLite是什么以及为什么您可能对使用它感兴趣",
  "Appropriate Uses For SQLite": "SQLite适用场景",
  "→ \n  This document describes situations where SQLite is an appropriate\n  database engine to use versus situations where a client/server\n  database engine might be a better choice.\n": "→ 本文档描述了SQLite合适使用的场景,以及客户端、服务端其他情况下更好的选择",
  "Distinctive Features": "特征对比",
  "→ \n  This document enumerates and describes some of the features of\n  SQLite that make it different from other SQL database engines.\n": "→ 本文档列举并描述了SQLite与其他SQL数据库引擎一些不同的特性。",
  "Quirks of SQLite": "SQLite自有特征",
  "→ \n  This document is a short list of some unusual features of SQLite\n  that tend to cause misunderstandings and confusion.  The list includes\n  both deliberate innovations and \"misfeatures\" that are retained only \n  for backwards compatibility.\n": "→ 本文档是SQLite一些非常用特性的列表,这些特性容易引起误解和无用。这个列表包含了经过深思熟虑的创新和“错误特性”,为了向后兼容只保留了这些特性。",
  "How SQLite Is Tested": "如何测试SQLite",
  "→ \n  The reliability and robustness of SQLite is achieved in large part\n  by thorough and careful testing.  This document identifies the\n  many tests that occur before every release of SQLite.\n": "→ SQLite的可靠性和健壮性在很大程度上是通过全面和仔细的测试实现的。本文档例举了SQLite每次发布之前进行测试用例。",
  "Copyright": "版权声明",
  "→ \n  SQLite is in the public domain.  This document describes what that means\n  and the implications for contributors.\n": "→ SQLite是开源的。本文档记录了源代码使用的限制条件,以及贡献者的权利及义务。",
  "→ \n  The title of the document says all...\n": "→ 标题已经说了……",
  "Books About SQLite": "SQLite相关书籍",
  "→ \n  A list of independently written books about SQLite.\n": "→ 关于SQLite使用的书籍列表",
  " Programming Interfaces": "编程接口",
  "SQLite In 5 Minutes Or Less": "",
  "→ \n  A very quick introduction to programming with SQLite.\n": "",
  "Introduction to the C/C++ API ": "",
  "→ \n  This document introduces the C/C++ API. Users should read this document \n  before the C/C++ API Reference Guide linked below.\n": "",
  "How To Compile SQLite": "",
  "→ \n  Instructions and hints for compiling SQLite C code and integrating\n  that code with your own application.\n": "",
  "C/C++ API Reference": "",
  "→ \n  This document describes each API function separately.\n": "",
  "Result and Error Codes": "",
  "→ \n  A description of the meanings of the numeric result codes\n  returned by various C/C++ interfaces.\n": "",
  "→ \n  This document describes the SQL language that is understood by\n  SQLite.  \n": "",
  "Pragma commands": "",
  "→ \n  This document describes SQLite performance tuning options and other \n  special purpose database commands.\n": "",
  "Core SQL Functions": "",
  "→ \n  General-purpose built-in scalar SQL functions.\n": "",
  "Aggregate SQL Functions": "",
  "→ \n  General-purpose built-in aggregate SQL functions.\n": "",
  "Date and Time SQL Functions": "",
  "→ \n  SQL functions for manipulating dates and times.\n": "",
  "System.Data.SQLite": "",
  "→ \n  C#/.NET bindings for SQLite\n": "",
  "Tcl API": "",
  "→ \n  A description of the TCL interface bindings for SQLite.\n": "",
  "DataTypes": "",
  "→ \n  SQLite version 3 introduces the concept of manifest typing, where the\n  type of a value is associated with the value itself, not the column that\n  it is stored in.\n  This page describes data typing for SQLite version 3 in further detail.\n": "",
  " Extensions": "扩展插件",
  "Json1 - JSON Integration": "",
  "→ \n  SQL functions for creating, parsing, and querying JSON content.\n": "",
  "FTS5 - Full Text Search": "",
  "→ \n  A description of the SQLite Full Text Search (FTS5) extension.\n": "",
  "FTS3 - Full Text Search": "",
  "→ \n  A description of the SQLite Full Text Search (FTS3) extension.\n": "",
  "R-Tree Module": "",
  "→ \n  A description of the SQLite R-Tree extension. An R-Tree is a specialized\n  data structure that supports fast multi-dimensional range queries often\n  used in geospatial systems.\n": "",
  "Sessions": "",
  "→ \n  The Sessions extension allows change to an SQLite database to be\n  captured in a compact file which can be reverted on the original\n  database (to implement \"undo\") or transferred and applied to another\n  similar database.\n": "",
  "Run-Time Loadable Extensions": "",
  "→ \n  A general overview on how run-time loadable extensions work, how they\n  are compiled, and how developers can create their own run-time loadable\n  extensions for SQLite.\n": "",
  "SQLite Android Bindings": "",
  "→ \n  Information on how to deploy your own private copy of SQLite on\n  Android, bypassing the built-in SQLite, but using the same Java\n  interface.\n": "",
  "Dbstat Virtual Table": "",
  "→ \n  The DBSTAT virtual table reports on the sizes and geometries of tables\n  storing content in an SQLite database, and is the basis for the\n  [sqlite3_analyzer] utility program.\n": "",
  "Csv Virtual Table": "",
  "→ \n  The CSV virtual table allows SQLite to directly read and query\n  [https://www.ietf.org/rfc/rfc4180.txt|RFC 4180] formatted files.\n": "",
  "Carray": "",
  "→ \n  CARRAY is a [table-valued function] that allows C-language arrays to\n  be used in SQL queries.\n": "",
  "generate_series": "",
  "→ \n  A description of the generate_series() [table-valued function].\n": "",
  "Spellfix1": "",
  "→ \n  The spellfix1 extension is an experiment in doing spelling correction\n  for [full-text search].\n": "",
  " Features": "特性",
  "8+3 Filenames": "",
  "→ \n  How to make SQLite work on filesystems that only support \n  8+3 filenames.\n": "",
  "Autoincrement": "",
  "→ \n  A description of the AUTOINCREMENT keyword in SQLite, what it does,\n  why it is sometimes useful, and why it should be avoided if not\n  strictly necessary.\n": "",
  "Backup API": "",
  "→ \n  The [sqlite3_backup_init | online-backup interface] can be used to\n  copy content from a disk file into an in-memory database or vice\n  versa and it can make a hot backup of a live database.  This application\n  note gives examples of how.\n": "",
  "Error and Warning Log": "",
  "→ \n  SQLite supports an \"error and warning log\" design to capture information\n  about suspicious and/or error events during operation.  Embedded applications\n  are encouraged to enable the error and warning log to help with debugging\n  application problems that arise in the field.  This document explains how\n  to do that.\n": "",
  "Foreign Key Support": "",
  "→ \n  This document describes the support for foreign key constraints introduced\n  in version 3.6.19.\n": "",
  "Indexes On Expressions": "",
  "→ \n  Notes on how to create indexes on expressions instead of just\n  individual columns.\n": "",
  "Internal versus External Blob Storage": "",
  "→ \n  Should you store large BLOBs directly in the database, or store them\n  in files and just record the filename in the database?  This document\n  seeks to shed light on that question.\n": "",
  "Limits In SQLite": "",
  "→ \n  This document describes limitations of SQLite (the maximum length of a\n  string or blob, the maximum size of a database, the maximum number of\n  tables in a database, etc.) and how these limits can be altered at\n  compile-time and run-time.\n": "",
  "Memory-Mapped I/O": "",
  "→ \n  SQLite supports memory-mapped I/O.  Learn how to enable memory-mapped\n  I/O and about the various advantages and disadvantages to using\n  memory-mapped I/O in this document.\n": "",
  "Multi-threaded Programs and SQLite": "",
  "→ \n  SQLite is safe to use in multi-threaded programs.  This document\n  provides the details and hints on how to maximize performance.\n": "",
  "Null Handling": "",
  "→ \n  Different SQL database engines handle NULLs in different ways.  The\n  SQL standards are ambiguous.  This (circa 2003) document describes\n  how SQLite handles NULLs in comparison with other SQL database engines.\n": "",
  "Partial Indexes": "",
  "→ \n  A partial index is an index that only covers a subset of the rows in\n  a table.  Learn how to use partial indexes in SQLite from this document.\n": "",
  "Shared Cache Mode": "",
  "→ \n  Version 3.3.0 and later supports the ability for two or more\n  database connections to share the same page and schema cache.\n  This feature is useful for certain specialized applications.\n": "",
  "Unlock Notify": "",
  "→ \n  The \"unlock notify\" feature can be used in conjunction with\n  [shared cache mode] to more efficiently manage resource conflict (database\n  table locks).\n": "",
  "URI Filenames": "",
  "→ \n  The names of database files can be specified using either an ordinary\n  filename or a URI.  Using URI filenames provides additional capabilities,\n  as this document describes.\n": "",
  "WITHOUT ROWID Tables": "",
  "→ \n  The WITHOUT ROWID optimization is a option that can sometimes result\n  in smaller and faster databases.\n": "",
  "Write-Ahead Log (WAL) Mode": "",
  "→ \n  Transaction control using a write-ahead log offers more concurrency and\n  is often faster than the default rollback transactions.  This document\n  explains how to use WAL mode for improved performance.\n": "",
  " Tools": "工具",
  "Command-Line Shell (sqlite3.exe)": "",
  "→ \n  Notes on using the \"sqlite3.exe\" command-line interface that\n  can be used to create, modify, and query arbitrary SQLite\n  database files.\n": "",
  "SQLite Database Analyzer (sqlite3_analyzer.exe)": "",
  "→ \n  This stand-alone program reads an SQLite database and outputs a file\n  showing the space used by each table and index and other statistics.\n  Built using the [dbstat virtual table].\n": "",
  "RBU": "",
  "→ \n  The \"Resumable Bulk Update\" utility program allows a batch of changes\n  to be applied to a remote database running on embedded hardware in a\n  way that is resumeable and does not interrupt ongoing operation.\n": "",
  "SQLite Database Diff (sqldiff.exe)": "",
  "→ \n  This stand-alone program compares two SQLite database files and\n  outputs the SQL needed to convert one into the other.\n": "",
  "Database Hash (dbhash.exe)": "",
  "→ \n  This program demonstrates how to compute a hash over the content\n  of an SQLite database.\n": "",
  "Fossil": "",
  "→ \n  The Fossil Version Control System is a distributed VCS designed specifically\n  to support SQLite development.  Fossil uses SQLite as for storage.\n": "",
  "SQLite Archiver (sqlar.exe)": "",
  "→ \n  A ZIP-like archive program that uses SQLite for storage.\n": "",
  " Advocacy": "",
  "SQLite As An Application File Format": "",
  "→ \n  This article advocates using SQLite as an application file format\n  in place of XML or JSON or a \"pile-of-file\".\n": "",
  "Well Known Users": "",
  "→ \n  This page lists a small subset of the many thousands of devices\n  and application programs that make use of SQLite.\n": "",
  "35% Faster Than The Filesystem": "",
  "→ \n  This article points out that reading blobs out of an SQLite database\n  is often faster than reading the same blobs from individual files in\n  the filesystem.\n": "",
  " Technical and Design Documentation": "技术及设计文档",
  "How Database Corruption Can Occur": "数据库损坏是如何发生的",
  "→ \n  SQLite is highly resistant to database corruption.  But application,\n  OS, and hardware bugs can still result in corrupt database files.\n  This article describes many of the ways that SQLite database files\n  can go corrupt.\n": "→ SQLite数据库损坏几率很小。但是应用程序、操作系统和硬件错误仍然会导致数据库文件损坏。本文描述了SQLite数据库文件损坏的许多方式。",
  "Temporary Files Used By SQLite": "SQLite使用的临时文件",
  "→ \n  SQLite can potentially use many different temporary files when\n  processing certain SQL statements.  This document describes the\n  many kinds of temporary files that SQLite uses and offers suggestions\n  for avoiding them on systems where creating a temporary file is an\n  expensive operation.\n": "→ SQLite可能会使用许多不同的临时文件来处理某些SQL语句。本文档描述了SQLite多种临时文件的使用场景,并提供了一些建议,以避免不必要的系统资源消耗",
  "In-Memory Databases": "",
  "→ \n  SQLite normally stores content in a disk file.  However, it can also\n  be used as an in-memory database engine.  This document explains how.\n": "",
  "How SQLite Implements Atomic Commit": "",
  "→ \n  A description of the logic within SQLite that implements\n  transactions with atomic commit, even in the face of power\n  failures.\n": "",
  "Dynamic Memory Allocation in SQLite": "",
  "→ \n  SQLite has a sophisticated memory allocation subsystem that can be\n  configured and customized to meet memory usage requirements of the\n  application and that is robust against out-of-memory conditions and\n  leak-free.  This document provides the details.\n": "",
  "Customizing And Porting SQLite": "",
  "→ \n  This document explains how to customize the build of SQLite and\n  how to port SQLite to new platforms.\n": "",
  "Locking And Concurrency": "",
  "In SQLite Version 3": "",
  "→ \n  A description of how the new locking code in version 3 increases\n  concurrency and decreases the problem of writer starvation.\n": "",
  "Isolation In SQLite": "",
  "→ \n  When we say that SQLite transactions are \"serializable\" what exactly\n  does that mean?  How and when are changes made visible within the\n  same database connection and to other database connections?\n": "",
  "Overview Of The Optimizer": "",
  "→ \n  A quick overview of the various query optimizations that are\n  attempted by the SQLite code generator.\n": "",
  "The Next-Generation Query Planner": "",
  "→ \n  Additional information about the SQLite query planner, and in particular\n  the redesign of the query planner that occurred for version 3.8.0.\n": "",
  "Architecture": "",
  "→ \n  An architectural overview of the SQLite library, useful for those who want\n  to hack the code.\n": "",
  "VDBE Opcodes": "",
  "→ \n  This document is an automatically generated description of the various\n  opcodes that the VDBE understands.  Programmers can use this document as\n  a reference to better understand the output of EXPLAIN listings from\n  SQLite.\n": "",
  "Virtual Filesystem": "",
  "→ \n  The \"VFS\" object is the interface between the SQLite core and the\n  underlying operating system.  Learn more about how the VFS object\n  works and how to create new VFS objects from this article.\n": "",
  "Virtual Tables": "",
  "→ \n  This article describes the virtual table mechanism and API in SQLite and how\n  it can be used to add new capabilities to the core SQLite library.\n": "",
  "SQLite File Format": "",
  "→ \n  A description of the format used for SQLite database and journal files, and\n  other details required to create software to read and write SQLite \n  databases without using SQLite.\n": "",
  "Compilation Options": "",
  "→ \n  This document describes the compile time options that may be set to \n  modify the default behavior of the library or omit optional features\n  in order to reduce binary size.\n": "",
  "Android Bindings for SQLite": "",
  "→ \n  A description of how to compile your own SQLite for Android\n  (bypassing the SQLite that is built into Android) together with\n  code and makefiles.\n": "",
  "Debugging Hints": "",
  "→ \n  A list of tricks and techniques used to trace, examine, and understand\n  the operation of the core SQLite library.\n": "",
  " Upgrading SQLite, Backwards Compatibility": "",
  "Moving From SQLite 3.5 to 3.6": "",
  "→ \n  A document describing the differences between SQLite version 3.5.9\n  and 3.6.0.\n": "",
  "Moving From SQLite 3.4 to 3.5": "",
  "→ \n  A document describing the differences between SQLite version 3.4.2\n  and 3.5.0.\n": "",
  "Release History": "",
  "→ \n  A chronology of SQLite releases going back to version 1.0.0\n": "",
  "Backwards Compatibility": "",
  "→ \n  This document details all of the incompatible changes to the SQLite\n  file format that have occurred since version 1.0.0.\n": "",
  "Private Branches": "",
  "→ \n  This document suggests procedures for maintaining a private branch\n  or fork of SQLite and keeping that branch or fork in sync with the\n  public SQLite source tree.\n": "",
  "\n\n": "",
  " Obsolete Documents": "",
  "Asynchronous IO Mode": "",
  "→ \n  This page describes the asynchronous IO extension developed alongside\n  SQLite. Using asynchronous IO can cause SQLite to appear more responsive\n  by delegating database writes to a background thread.  ": "",
  "NB:  This\n  extension is deprecated.  [WAL mode] is recommended as a replacement.": "",
  "Version 2 C/C++ API": "",
  "→ \n  A description of the C/C++ interface bindings for SQLite through version \n  2.8\n": "",
  "Version 2 DataTypes ": "",
  "→ \n  A description of how SQLite version 2 handles SQL datatypes.\n  Short summary:  Everything is a string.\n": "",
  "VDBE Tutorial": "",
  "→ \n  The VDBE is the subsystem within SQLite that does the actual work of\n  executing SQL statements.  This page describes the principles of operation\n  for the VDBE in SQLite version 2.7.  This is essential reading for anyone\n  who want to modify the SQLite sources.\n": "",
  "SQLite Version 3": "SQLite第三版",
  "→ \n  A summary of the changes between SQLite version 2.8 and SQLite version 3.0.\n": "SQLite2.8版与3.0版功能的差异",
  "Version 3 C/C++ API": "第三版c/c++API",
  "→ \n  A summary of the API related changes between SQLite version 2.8 and \n  SQLite version 3.0. \n": "SQLite2.8版与3.0版,API的差异",
  "Speed Comparison": "速度比较",
  "→ \n  The speed of version 2.7.6 of SQLite is compared against PostgreSQL and\n  MySQL.\n": "2.7.6版本的SQLite与MySQL与PostgreSQL之间的差异"
}

var excutNode = ['IMG','BR','HR','FORM','SELECT','OPTION','INPUT','SCRIPT','STYLE']

console.time('translate')
allNodeArr.forEach(item=>{    
    if (item.childNodes && !excutNode.includes(item.nodeName)) {
        item.childNodes.forEach(item => {
            if(item.nodeName === '#text'){
                var text = textObj[item.data]
                if(text){
                    item.data = text
                }
                 
            }            
        })
    }
})
console.timeEnd('translate')