Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions Documentation/userspace-api/locale.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,22 @@
配置与翻译
==========

区域配置位于 ``/etc/reliefos/locale.conf``。gettext 翻译源位于
``configs/nls/po/``,现有 ``leonos`` domain 与 MO 文件名是兼容数据,不是产品名。
新增 UI 字符串同步消息表与翻译;nls 目标生成资源,只写所选输出树。
区域配置位于 ``/etc/reliefos/locale.conf``。应用通过 gettext 加载各自的翻译域,
域名与应用源码目录名一致。``configs/nls/DOMAINS`` 登记翻译域,
``configs/nls/LINGUAS`` 登记随系统构建的语言。

例如,Fileman 的模板位于 ``configs/nls/po/fileman/fileman.pot``,中文译文位于
``configs/nls/po/fileman/zh_CN.po``。``make nls`` 将其编译为
``O/generated/nls/zh_CN/LC_MESSAGES/fileman.mo``,镜像安装到
``/usr/share/locale/zh_CN/LC_MESSAGES/fileman.mo``。Taskmgr 使用独立的
``taskmgr`` 翻译域和对应目录。FLTK 公共按钮与文件选择器文案收录在各自应用的目录中。

修改 Fileman 文案后执行 ``make nls-update-fileman``,可更新该应用的模板和译文。
``make nls-update`` 更新已登记的全部应用。提取范围包含应用的子目录、
公共 FLTK 头文件、Kbuild 中复用的实现及该应用的
``configs/nls/messages/<应用名>.c`` 动态文案标记。
新增应用时登记翻译域,并为 ``LINGUAS`` 中的每种语言创建对应的 PO 文件。
常规构建只生成所选输出树中的资源,翻译源文件由显式维护目标更新。
系统更新时,应用二进制与对应翻译资源一起更新。

原生文件格式的容量、恢复与字符边界见各应用手册。
2 changes: 1 addition & 1 deletion configs/apk-ownership.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"destination": "reliefos",
"components": [],
"paths": ["usr/share/locale/zh_CN"],
"reason": "Message catalogs from configs/nls/po, scoped per language to preserve upstream catalog ownership."
"reason": "Per-application gettext catalogs from configs/nls/po/<domain>, scoped per language to preserve upstream catalog ownership."
},
"reliefos-apps": {
"destination": "reliefos",
Expand Down
47 changes: 47 additions & 0 deletions configs/nls/DOMAINS
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiapp
browser
calc
devmgr
diskmgr
doom
doomlauncher
downloadmgr
drvmgr
dynlinkerror
fileman
guitest
hello
helloworld
httpget
imageview
installer
leonmmcoset
minesweeper
mp3play
netctl
network-controller
notepad
openrc-controller
oshlp
osver
paint
reliefapk
reliefaskpass
reliefcapture
reliefdiagram
reliefexcel
reliefmail
reliefmath
reliefmathpp
reliefplayer
reliefppt
relieftodo
reliefword
run
servicemgr
settings
sudod
sysconfdialog
taskmgr
terminal
xiaobai
9 changes: 9 additions & 0 deletions configs/nls/messages/browser.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const browser_indirect_messages[] = {
N_(" bytes"),
N_("Path"),
N_("Reset"),
N_("none"),
};
7 changes: 7 additions & 0 deletions configs/nls/messages/calc.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const calc_indirect_messages[] = {
N_("bit"),
N_("s"),
};
6 changes: 6 additions & 0 deletions configs/nls/messages/devmgr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const devmgr_indirect_messages[] = {
N_("Ready"),
};
6 changes: 6 additions & 0 deletions configs/nls/messages/downloadmgr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const downloadmgr_indirect_messages[] = {
N_("Ready"),
};
6 changes: 6 additions & 0 deletions configs/nls/messages/drvmgr.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const drvmgr_indirect_messages[] = {
N_("Ready"),
};
6 changes: 6 additions & 0 deletions configs/nls/messages/fileman.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const fileman_indirect_messages[] = {
N_("Launch failed "),
};
6 changes: 6 additions & 0 deletions configs/nls/messages/guitest.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const guitest_indirect_messages[] = {
N_("Ready"),
};
7 changes: 7 additions & 0 deletions configs/nls/messages/httpget.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const httpget_indirect_messages[] = {
N_(" bytes"),
N_("Ready"),
};
18 changes: 18 additions & 0 deletions configs/nls/messages/installer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#define N_(s) (s)

/* Progress and failure strings passed to translated installer callbacks. */
static const char *const installer_progress_messages[] = {
N_("Mounting target filesystems"),
N_("Mount failed"),
};

/* Strings supplied by shared code and dynamic application labels. */
static const char *const installer_indirect_messages[] = {
N_("Confirm password"),
N_("Delete"),
N_("Format"),
N_("Password:"),
N_("Ready"),
N_("Rename"),
N_("none"),
};
9 changes: 9 additions & 0 deletions configs/nls/messages/mp3play.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const mp3play_indirect_messages[] = {
N_("Open"),
N_("Playback complete"),
N_("Playing"),
N_("Stop"),
};
8 changes: 8 additions & 0 deletions configs/nls/messages/netctl.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const netctl_indirect_messages[] = {
N_("Ready"),
N_("State"),
N_("s"),
};
7 changes: 7 additions & 0 deletions configs/nls/messages/network-controller.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const network_controller_indirect_messages[] = {
N_("Authenticating"),
N_("Export output"),
};
10 changes: 10 additions & 0 deletions configs/nls/messages/openrc-controller.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const openrc_controller_indirect_messages[] = {
N_("Advanced"),
N_("Authenticating"),
N_("Disable"),
N_("Enable"),
N_("failed"),
};
34 changes: 34 additions & 0 deletions configs/nls/messages/reliefcapture.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#define N_(s) (s)

/* ReliefCapture worker errors and application name. */
static const char *const reliefcapture_static_labels[] = {
N_("Could not reserve Escape for capture cancellation"),
N_("Could not crop the screenshot"),
N_("A screenshot operation is already running"),
N_("Could not configure the screenshot channel"),
N_("Could not connect to the X11 display"),
N_("Could not contact the existing screenshot window"),
N_("Could not create the screenshot channel"),
N_("Could not create the temporary screenshot"),
N_("Could not encode the screenshot"),
N_("Could not inspect the destination"),
N_("Could not open the destination folder"),
N_("Could not read the screen image"),
N_("Could not read the screenshot process reply"),
N_("Could not register the screenshot window"),
N_("Could not render the screenshot"),
N_("Could not save the screenshot"),
N_("Could not start the screenshot process"),
N_("Invalid destination path"),
N_("Invalid screenshot process reply"),
N_("Not enough memory"),
N_("ReliefCapture"),
N_("Screenshot saved, but folder synchronization failed"),
N_("The destination changed; choose Save again"),
N_("The destination must be a regular file"),
N_("The screen is too large or its pixel format is unsupported"),
N_("The screenshot operation failed"),
N_("The screenshot operation timed out"),
N_("The screenshot process stopped unexpectedly"),
N_("There is no screenshot to save"),
};
9 changes: 9 additions & 0 deletions configs/nls/messages/reliefdiagram.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define N_(s) (s)

/* ReliefDiagram desktop application label. */
static const char *const reliefdiagram_static_labels[] = { N_("ReliefDiagram") };

/* Strings supplied by shared code and dynamic application labels. */
static const char *const reliefdiagram_indirect_messages[] = {
N_("none"),
};
6 changes: 6 additions & 0 deletions configs/nls/messages/reliefexcel.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const reliefexcel_indirect_messages[] = {
N_("I/O error"),
};
9 changes: 9 additions & 0 deletions configs/nls/messages/reliefmail.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#define N_(s) (s)

/* Strings supplied by shared code and dynamic application labels. */
static const char *const reliefmail_indirect_messages[] = {
N_("UID"),
N_("none"),
N_("s"),
N_("worker error"),
};
102 changes: 0 additions & 102 deletions configs/nls/messages.c → configs/nls/messages/reliefmath.c
Original file line number Diff line number Diff line change
@@ -1,36 +1,4 @@
/* Labels supplied by oschinpt/settings.ini, registered for extraction. */
#define N_(s) (s)
static const char *const input_method_labels[] = {
N_("Chinese punctuation"),
N_("Full-width space"),
N_("Learn selected candidates"),
};

/* The toolkit-independent importer returns this warning to the translated UI. */
static const char *const reliefword_import_messages[] = {
N_("Some HTML links, tables, or embedded objects were flattened or skipped"),
};

/* ReliefPPT's toolkit-independent renderer returns these translated errors. */
static const char *const reliefppt_messages[] = {
N_("Could not capture the edited text"),
N_("The file changed while it was being opened"),
N_("Invalid image reference"),
N_("Not enough memory to draw the image"),
N_("Not enough memory to draw text"),
N_("Could not render the slide image"),
N_("Could not encode the slide image"),
N_("Export cancelled"),
N_("HTML export is too large"),
N_("Not enough memory to export HTML"),
N_("Could not read the image file"),
N_("Image dimensions exceed the supported limit"),
N_("Could not decode the PNG image"),
N_("Could not open the image"),
N_("Could not read the image"),
N_("Use PNG or an uncompressed 24/32-bit BMP image"),
N_("The BMP image is truncated"),
};

/* ReliefMath's application identity and shared tool labels. */
static const char *const reliefmath_static_labels[] = {
Expand Down Expand Up @@ -658,73 +626,3 @@ static const char *const reliefmath_error_messages[] = {
N_("unsupported recovery snapshot version"),
N_("worker error"),
};

/* ReliefDiagram desktop application label. */
static const char *const reliefdiagram_static_labels[] = { N_("ReliefDiagram") };

/* ReliefTodo labels used through enumeration lookup tables. */
static const char *const relieftodo_static_labels[] = {
N_("ReliefTodo"),
N_("Low"),
N_("Normal"),
N_("High"),
N_("Urgent"),
N_("All tasks"),
N_("Today"),
N_("Upcoming"),
N_("Completed"),
N_("Overdue"),
N_("Active tasks"),
N_("Manual order"),
N_("Priority"),
N_("Due date"),
N_("Recently updated"),
N_("Task title"),
};

/* ReliefPlayer labels returned by the decoder error table. */
static const char *const reliefplayer_static_labels[] = {
N_("ReliefPlayer"),
N_("Could not read the media file"),
N_("Invalid or truncated media file"),
N_("Unsupported media format or codec"),
N_("Media exceeds the supported size or resolution"),
N_("Not enough memory"),
N_("Audio device is unavailable"),
N_("Audio device is busy"),
N_("Media playback failed"),
N_("Playback process stopped unexpectedly"),
};

/* ReliefCapture worker errors and application name. */
static const char *const reliefcapture_static_labels[] = {
N_("Could not reserve Escape for capture cancellation"),
N_("Could not crop the screenshot"),
N_("A screenshot operation is already running"),
N_("Could not configure the screenshot channel"),
N_("Could not connect to the X11 display"),
N_("Could not contact the existing screenshot window"),
N_("Could not create the screenshot channel"),
N_("Could not create the temporary screenshot"),
N_("Could not encode the screenshot"),
N_("Could not inspect the destination"),
N_("Could not open the destination folder"),
N_("Could not read the screen image"),
N_("Could not read the screenshot process reply"),
N_("Could not register the screenshot window"),
N_("Could not render the screenshot"),
N_("Could not save the screenshot"),
N_("Could not start the screenshot process"),
N_("Invalid destination path"),
N_("Invalid screenshot process reply"),
N_("Not enough memory"),
N_("ReliefCapture"),
N_("Screenshot saved, but folder synchronization failed"),
N_("The destination changed; choose Save again"),
N_("The destination must be a regular file"),
N_("The screen is too large or its pixel format is unsupported"),
N_("The screenshot operation failed"),
N_("The screenshot operation timed out"),
N_("The screenshot process stopped unexpectedly"),
N_("There is no screenshot to save"),
};
22 changes: 22 additions & 0 deletions configs/nls/messages/reliefplayer.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#define N_(s) (s)

/* ReliefPlayer labels returned by the decoder error table. */
static const char *const reliefplayer_static_labels[] = {
N_("ReliefPlayer"),
N_("Could not read the media file"),
N_("Invalid or truncated media file"),
N_("Unsupported media format or codec"),
N_("Media exceeds the supported size or resolution"),
N_("Not enough memory"),
N_("Audio device is unavailable"),
N_("Audio device is busy"),
N_("Media playback failed"),
N_("Playback process stopped unexpectedly"),
};

/* Strings supplied by shared code and dynamic application labels. */
static const char *const reliefplayer_indirect_messages[] = {
N_("Cancelled"),
N_("Ready"),
N_("failed"),
};
Loading
Loading