From 0a3f2d7ff2e652ff407bf4c90a72ffbafb887c0f Mon Sep 17 00:00:00 2001 From: renpeiying Date: Thu, 13 Aug 2026 16:03:29 +0800 Subject: [PATCH] docs(nvs_flash): update CN translation --- docs/en/api-reference/storage/nvs_flash.rst | 4 ++-- docs/zh_CN/api-reference/storage/nvs_flash.rst | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/en/api-reference/storage/nvs_flash.rst b/docs/en/api-reference/storage/nvs_flash.rst index 27058ce9c23..8c0ac1c546a 100644 --- a/docs/en/api-reference/storage/nvs_flash.rst +++ b/docs/en/api-reference/storage/nvs_flash.rst @@ -76,7 +76,7 @@ Namespaces To mitigate potential conflicts in key names between different components, NVS assigns each key-value pair to one of the namespaces. Namespace names follow the same rules as key names, i.e., the maximum length is 15 characters. Furthermore, there can be no more than 254 different namespaces in one NVS partition. Namespace name is specified in the :cpp:func:`nvs_open` or :cpp:type:`nvs_open_from_partition` call. This call returns an opaque handle, which is used in subsequent calls to the ``nvs_get_*``, ``nvs_set_*``, and :cpp:func:`nvs_commit` functions. This way, a handle is associated with a namespace and partition, and key names will not collide with same names in other namespaces. -The open mode parameter controls the access level and security behavior: +The ``open_mode`` parameter controls the access level and security behavior: - ``NVS_READONLY``: Read-only access. All write operations will be rejected. - ``NVS_READWRITE``: Standard read-write access. Erased data is marked as deleted but remains in flash. @@ -100,7 +100,7 @@ Use ``nvs::open_nvs_handle()`` or ``nvs::open_nvs_handle_from_partition()`` to o - ``set_blob`` / ``get_blob`` — binary blob values - ``commit``, ``erase_item``, ``erase_all``, ``purge_all``, ``find_key``, and related helpers -Open modes (``NVS_READONLY``, ``NVS_READWRITE``, ``NVS_READWRITE_PURGE``) and key/namespace constraints are the same as for the C API. See the :ref:`API Reference ` below for full class and function documentation, and :example:`storage/nvs/nvs_rw_value_cxx` for a complete example. +The ``open_mode`` values (``NVS_READONLY``, ``NVS_READWRITE``, ``NVS_READWRITE_PURGE``) and key and namespace constraints are the same as for the C API. See the :ref:`API Reference ` below for full class and function documentation, and :example:`storage/nvs/nvs_rw_value_cxx` for a complete example. NVS Iterators ^^^^^^^^^^^^^ diff --git a/docs/zh_CN/api-reference/storage/nvs_flash.rst b/docs/zh_CN/api-reference/storage/nvs_flash.rst index e0e0195cb71..7b5a87cf1ee 100644 --- a/docs/zh_CN/api-reference/storage/nvs_flash.rst +++ b/docs/zh_CN/api-reference/storage/nvs_flash.rst @@ -76,7 +76,7 @@ NVS 的操作对象为键值对,其中键是 ASCII 字符串,当前支持的 为减少不同组件之间键名的潜在冲突,NVS 将每个键值对分配到一个命名空间。命名空间的命名规则遵循键名的命名规则,例如,最多可占 15 个字符。此外,单个 NVS 分区最多只能容纳 254 个不同的命名空间。命名空间的名称在调用 :cpp:func:`nvs_open` 或 :cpp:type:`nvs_open_from_partition` 中指定。调用后将返回一个不透明句柄,用于后续调用 ``nvs_get_*``、``nvs_set_*`` 和 :cpp:func:`nvs_commit` 函数。这样,句柄就与命名空间和分区关联,键名不会与其他命名空间中的同名键发生冲突。 -open mode 参数控制访问级别和安全行为: +``open_mode`` 参数控制访问级别和安全行为: - ``NVS_READONLY``:只读访问权限。所有写操作将被拒绝。 - ``NVS_READWRITE``:标准读写访问权限。被擦除的数据会被标记为已删除,但仍保留在 flash 中。 @@ -91,7 +91,7 @@ C++ API 除上文所述的 C API 外,NVS 还在 :component_file:`nvs_flash/include/nvs_handle.hpp` 中提供了 C++ 类接口(命名空间 ``nvs``)。 -使用 ``nvs::open_nvs_handle()`` 或 ``nvs::open_nvs_handle_from_partition()`` 打开命名空间。这些函数返回 ``std::unique_ptr``。当该智能指针被销毁时,句柄会自动关闭(RAII),因此无需另行调用关闭函数。 +使用 ``nvs::open_nvs_handle()`` 或 ``nvs::open_nvs_handle_from_partition()`` 打开命名空间。这些函数返回 ``std::unique_ptr``。当该 ``std::unique_ptr`` 被销毁时,句柄会自动关闭(RAII),因此无需另行调用关闭函数。 ``nvs::NVSHandle`` 提供与 C API 对应的方法,包括: @@ -100,7 +100,7 @@ C++ API - ``set_blob`` / ``get_blob`` — 二进制 blob 值 - ``commit``、``erase_item``、``erase_all``、``purge_all``、``find_key`` 及相关辅助方法 -打开模式(``NVS_READONLY``、``NVS_READWRITE``、``NVS_READWRITE_PURGE``)以及键名/命名空间约束与 C API 相同。完整的类与函数说明见下文 :ref:`API 参考 `,完整示例见 :example:`storage/nvs/nvs_rw_value_cxx`。 +``open_mode`` 的取值( ``NVS_READONLY``、``NVS_READWRITE``、``NVS_READWRITE_PURGE``)以及键名和命名空间约束与 C API 相同。完整的类与函数说明见下文 :ref:`API 参考 `,完整示例见 :example:`storage/nvs/nvs_rw_value_cxx`。 NVS 迭代器 ^^^^^^^^^^^^^