Retranslate the complete Japanese online edition from Chinese (#2008)

* Retranslate the complete Japanese online edition from Chinese

* Fit Japanese homepage labels and localize heading permalinks

* Point Japanese contribution instructions to the Japanese preview

* Replace locale conditionals with multilingual UI tables
This commit is contained in:
Yudong Jin
2026-10-30 02:12:26 +08:00
committed by GitHub
parent 455e8c1281
commit 7257641e0e
1987 changed files with 23531 additions and 23261 deletions
+26 -26
View File
@@ -5,7 +5,7 @@
const std = @import("std");
const inc = @import("include");
// キーと値の組
// キーと値のペア
const Pair = struct {
key: usize = undefined,
val: []const u8 = undefined,
@@ -18,7 +18,7 @@ const Pair = struct {
}
};
// 配列ベースのハッシュテーブル
// 配列で実装したハッシュテーブル
pub fn ArrayHashMap(comptime T: type) type {
return struct {
bucket: ?std.ArrayList(?T) = null,
@@ -48,7 +48,7 @@ pub fn ArrayHashMap(comptime T: type) type {
return index;
}
// 検索操作
// 取得操作
pub fn get(self: *Self, key: usize) []const u8 {
var index = hashFunc(key);
var pair = self.bucket.?.items[index];
@@ -65,11 +65,11 @@ pub fn ArrayHashMap(comptime T: type) type {
// 削除操作
pub fn remove(self: *Self, key: usize) !void {
var index = hashFunc(key);
// null に設定し、削除を表す
// null に設定して、削除を表す
self.bucket.?.items[index] = null;
}
// すべてのキーと値のペアを取得
// キーと値のペアをすべて取得する
pub fn pairSet(self: *Self) !std.ArrayList(T) {
var entry_set = std.ArrayList(T).init(self.mem_allocator);
for (self.bucket.?.items) |item| {
@@ -79,7 +79,7 @@ pub fn ArrayHashMap(comptime T: type) type {
return entry_set;
}
// すべてのキーを取得
// すべてのキーを取得する
pub fn keySet(self: *Self) !std.ArrayList(usize) {
var key_set = std.ArrayList(usize).init(self.mem_allocator);
for (self.bucket.?.items) |item| {
@@ -89,7 +89,7 @@ pub fn ArrayHashMap(comptime T: type) type {
return key_set;
}
// すべての値を取得
// すべての値を取得する
pub fn valueSet(self: *Self) !std.ArrayList([]const u8) {
var value_set = std.ArrayList([]const u8).init(self.mem_allocator);
for (self.bucket.?.items) |item| {
@@ -99,7 +99,7 @@ pub fn ArrayHashMap(comptime T: type) type {
return value_set;
}
// ハッシュテーブルを出力
// ハッシュテーブルを表示する
pub fn print(self: *Self) !void {
var entry_set = try self.pairSet();
defer entry_set.deinit();
@@ -110,48 +110,48 @@ pub fn ArrayHashMap(comptime T: type) type {
};
}
// Driver Code
// 実行用コード
pub fn main() !void {
// ハッシュテーブルを初期化
// ハッシュテーブルを初期化する
var map = ArrayHashMap(Pair){};
try map.init(std.heap.page_allocator);
defer map.deinit();
// 追加操作
// ハッシュテーブルにキーと値の組 (key, value) を追加する
try map.put(12836, "シャオハー");
try map.put(15937, "シャオルオ");
try map.put(16750, "シャオスワン");
try map.put(13276, "シャオファー");
try map.put(10583, "シャオヤー");
std.debug.print("\n追加完了後、ハッシュテーブルは\nKey -> Value\n", .{});
// ハッシュテーブルにキーと値のペア (key, value) を追加する
try map.put(12836, "小哈");
try map.put(15937, "小啰");
try map.put(16750, "小算");
try map.put(13276, "小法");
try map.put(10583, "小鸭");
std.debug.print("\n追加後のハッシュテーブル\nKey -> Value\n", .{});
try map.print();
// 検索操作
// ハッシュテーブルにキー key を入力し、値 value を取得する
// 取得操作
// ハッシュテーブルにキー key を渡し、値 value を取得する
var name = map.get(15937);
std.debug.print("\n学籍番号 15937 を入力すると、名前 {s} が見つかります\n", .{name});
std.debug.print("\n学生番号 15937 に対応する氏名は {s}\n", .{name});
// 削除操作
// ハッシュテーブルからキーと値の組 (key, value) を削除する
// ハッシュテーブルからキーと値のペア (key, value) を削除する
try map.remove(10583);
std.debug.print("\n10583 を削除した後、ハッシュテーブルは\nKey -> Value\n", .{});
std.debug.print("\n10583 を削除した後のハッシュテーブル\nKey -> Value\n", .{});
try map.print();
// ハッシュテーブルを走査
std.debug.print("\nキーと値の組 Key->Value を順に表示\n", .{});
// ハッシュテーブルを走査する
std.debug.print("\nキーと値のペア Key->Value を走査する\n", .{});
var entry_set = try map.pairSet();
for (entry_set.items) |kv| {
std.debug.print("{} -> {s}\n", .{kv.key, kv.val});
}
defer entry_set.deinit();
std.debug.print("\nキー Key のみを順に表示\n", .{});
std.debug.print("\nキー Key だけを走査する\n", .{});
var key_set = try map.keySet();
for (key_set.items) |key| {
std.debug.print("{}\n", .{key});
}
defer key_set.deinit();
std.debug.print("\n値 value のみを順に表示\n", .{});
std.debug.print("\n値 value だけを走査する\n", .{});
var value_set = try map.valueSet();
for (value_set.items) |val| {
std.debug.print("{s}\n", .{val});