diff --git a/js/admin-media.js b/js/admin-media.js index e611e96..7b3aed1 100644 --- a/js/admin-media.js +++ b/js/admin-media.js @@ -38,7 +38,7 @@ // 权重输入已整合到卡片内部 旧容器不再使用 // 形状标签映射用于显示友好名称 - var shapeLabelsMap = { + var shapeLabelsMap = (typeof window !== 'undefined' && window.YooneSnowAdmin && window.YooneSnowAdmin.shapeLabels) ? window.YooneSnowAdmin.shapeLabels : { dot: 'Dot', flake: 'Snowflake', yuanbao: 'Yuanbao', diff --git a/languages/yoone-snow-zh_CN.mo b/languages/yoone-snow-zh_CN.mo new file mode 100644 index 0000000..cd1a4a9 Binary files /dev/null and b/languages/yoone-snow-zh_CN.mo differ diff --git a/languages/yoone-snow-zh_CN.po b/languages/yoone-snow-zh_CN.po new file mode 100644 index 0000000..d2524d9 --- /dev/null +++ b/languages/yoone-snow-zh_CN.po @@ -0,0 +1,168 @@ +msgid "" +msgstr "" +"Project-Id-Version: yoone-snow\n" +"Language: zh_CN\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Plural-Forms: nplurals=1; plural=0;\n" + +# Plugin and menu +msgid "Yoone Snow" +msgstr "Yoone Snow" + +msgid "Settings" +msgstr "设置" + +# Section and fields +msgid "Snow Settings" +msgstr "雪花设置" + +msgid "Configure snow appearance" +msgstr "配置雪花外观" + +msgid "Shapes" +msgstr "形状" + +msgid "Type" +msgstr "类型" + +msgid "Default" +msgstr "默认" + +msgid "Emoji" +msgstr "Emoji" + +msgid "Media" +msgstr "媒体" + +msgid "Text" +msgstr "文本" + +msgid "Select shape" +msgstr "选择形状" + +msgid "Select emoji" +msgstr "选择 Emoji" + +msgid "Type emoji or alias" +msgstr "输入 Emoji 或别名" + +msgid "Add Images" +msgstr "添加图片" + +msgid "Remove" +msgstr "移除" + +msgid "Cancel" +msgstr "取消" + +msgid "Add shapes by type all in one list" +msgstr "按类型统一添加到列表" + +msgid "Add different types of shapes here" +msgstr "在此添加不同类型的形状" + +# Shape labels +msgid "Dot" +msgstr "圆点" + +msgid "Snowflake" +msgstr "雪花" + +msgid "Yuanbao" +msgstr "元宝" + +msgid "Coin" +msgstr "金币" + +msgid "Santa Hat" +msgstr "圣诞帽" + +msgid "Candy Cane" +msgstr "拐杖糖" + +msgid "Christmas Sock" +msgstr "圣诞袜" + +msgid "Christmas Tree" +msgstr "圣诞树" + +msgid "Reindeer" +msgstr "麋鹿" + +msgid "Christmas Berry" +msgstr "冬青果" + +# Shape descriptions +msgid "Basic dot shape simple and lightweight" +msgstr "基础圆点形状 简洁轻量" + +msgid "Snowflake shape more decorative" +msgstr "雪花形状 更具装饰性" + +msgid "Yuanbao shape festive theme" +msgstr "元宝形状 节日气氛" + +msgid "Coin shape festive theme" +msgstr "金币形状 节日气氛" + +msgid "Santa hat shape seasonal theme" +msgstr "圣诞帽形状 应季主题" + +msgid "Candy cane shape seasonal theme" +msgstr "拐杖糖形状 应季主题" + +msgid "Christmas sock shape seasonal theme" +msgstr "圣诞袜形状 应季主题" + +msgid "Christmas tree shape seasonal theme" +msgstr "圣诞树形状 应季主题" + +msgid "Reindeer shape seasonal theme" +msgstr "麋鹿形状 应季主题" + +msgid "Christmas berry shape seasonal theme" +msgstr "冬青果形状 应季主题" + +# Weight explanation +msgid "Weight controls relative probability Weight is a non negative integer Weight 0 disables a shape Probability equals shape weight divided by the sum of all shape weights Example dot 1 flake 4 flake has about four times the chance of dot" +msgstr "权重用于控制随机生成的相对概率 权重为非负整数 权重为 0 表示禁用 某形状概率等于其权重除以所有形状权重之和 例如 dot 1 flake 4 flake 概率约为 dot 的四倍" + +# Other settings +msgid "Home Display Duration Seconds" +msgstr "首页显示时长 秒" + +msgid "Duration in seconds for snow on home 0 means infinite" +msgstr "首页雪花显示时长 单位秒 0 表示无限" + +msgid "Max Snowflakes On Screen" +msgstr "在屏最大雪花数量" + +msgid "0 means auto based on viewport area upper bound 1000" +msgstr "0 表示根据视口面积自动 上限 1000" + +msgid "Snow Size" +msgstr "雪花尺寸" + +msgid "Random radius in [min max] single option" +msgstr "随机半径在最小与最大之间 单一选项保存" + +msgid "Min" +msgstr "最小" + +msgid "Max" +msgstr "最大" + +msgid "Drift Speed Random Range" +msgstr "漂移速度随机范围" + +msgid "Random vertical drift speed base in [min max]" +msgstr "垂直漂移速度基值在最小与最大之间随机" + +msgid "Swing Amplitude Random Range" +msgstr "摆动幅度随机范围" + +msgid "Random horizontal swing amplitude base in [min max] before offset scale" +msgstr "水平摆动幅度基值在最小与最大之间随机 应用偏移缩放前" + +msgid "Select images or SVG" +msgstr "选择图片或 SVG" diff --git a/yoone-snow.php b/yoone-snow.php index 506777c..5c9ebe2 100644 --- a/yoone-snow.php +++ b/yoone-snow.php @@ -324,6 +324,18 @@ function yoone_snow_admin_enqueue($hook) { 'reindeer' => plugins_url('assets/圣诞麋鹿.svg', __FILE__), 'christmas_berry' => plugins_url('assets/圣诞果.svg', __FILE__), ), + 'shapeLabels' => array( + 'dot' => esc_html__('Dot', 'yoone-snow'), + 'flake' => esc_html__('Snowflake', 'yoone-snow'), + 'yuanbao' => esc_html__('Yuanbao', 'yoone-snow'), + 'coin' => esc_html__('Coin', 'yoone-snow'), + 'santa_hat' => esc_html__('Santa Hat', 'yoone-snow'), + 'candy_cane' => esc_html__('Candy Cane', 'yoone-snow'), + 'christmas_sock' => esc_html__('Christmas Sock', 'yoone-snow'), + 'christmas_tree' => esc_html__('Christmas Tree', 'yoone-snow'), + 'reindeer' => esc_html__('Reindeer', 'yoone-snow'), + 'christmas_berry' => esc_html__('Christmas Berry', 'yoone-snow'), + ), 'i18n' => array( 'cancel' => esc_html__('Cancel', 'yoone-snow'), 'remove' => esc_html__('Remove', 'yoone-snow'), @@ -400,16 +412,16 @@ function yoone_snow_register_settings() { } if (!is_array($current_list)) { $current_list = array('dot','flake'); } $options = array( - 'dot' => 'Dot', - 'flake' => 'Snowflake', - 'yuanbao' => 'Yuanbao', - 'coin' => 'Coin', - 'santa_hat' => 'Santa Hat', - 'candy_cane' => 'Candy Cane', - 'christmas_sock' => 'Christmas Sock', - 'christmas_tree' => 'Christmas Tree', - 'reindeer' => 'Reindeer', - 'christmas_berry' => 'Christmas Berry', + 'dot' => esc_html__('Dot', 'yoone-snow'), + 'flake' => esc_html__('Snowflake', 'yoone-snow'), + 'yuanbao' => esc_html__('Yuanbao', 'yoone-snow'), + 'coin' => esc_html__('Coin', 'yoone-snow'), + 'santa_hat' => esc_html__('Santa Hat', 'yoone-snow'), + 'candy_cane' => esc_html__('Candy Cane', 'yoone-snow'), + 'christmas_sock' => esc_html__('Christmas Sock', 'yoone-snow'), + 'christmas_tree' => esc_html__('Christmas Tree', 'yoone-snow'), + 'reindeer' => esc_html__('Reindeer', 'yoone-snow'), + 'christmas_berry' => esc_html__('Christmas Berry', 'yoone-snow'), ); // 形状描述映射 用于在界面提示 使用国际化函数 $shape_descriptions = array( @@ -708,12 +720,12 @@ function yoone_snow_register_settings() { // 添加首页显示时长字段 输入为数字最小值为 0 add_settings_field( 'yoone_snow_home_duration', - 'Home Display Duration Seconds', + esc_html__('Home Display Duration Seconds', 'yoone-snow'), function() { // 读取当前设置值 并渲染数字输入框 $current = intval(get_option('yoone_snow_home_duration', 0)); echo ''; - echo '
Duration in seconds for snow on home 0 means infinite
'; + echo '' . esc_html__('Duration in seconds for snow on home 0 means infinite', 'yoone-snow') . '
'; }, 'yoone_snow', 'yoone_snow_section' @@ -735,11 +747,11 @@ function yoone_snow_register_settings() { // 添加输入字段 用于设置在屏最大数量 0 表示自动 add_settings_field( 'yoone_snow_max_count', - 'Max Snowflakes On Screen', + esc_html__('Max Snowflakes On Screen', 'yoone-snow'), function() { $current = intval(get_option('yoone_snow_max_count', 0)); echo ''; - echo '0 means auto based on viewport area upper bound 1000
'; + echo '' . esc_html__('0 means auto based on viewport area upper bound 1000', 'yoone-snow') . '
'; }, 'yoone_snow', 'yoone_snow_section' @@ -762,15 +774,15 @@ function yoone_snow_register_settings() { add_settings_field( 'yoone_snow_size', - 'Snow Size', + esc_html__('Snow Size', 'yoone-snow'), function() { // 渲染组合输入 使用同一选项保存最小与最大半径 $grp = get_option('yoone_snow_size', array('min' => 1.0, 'max' => 3.0)); $min = isset($grp['min']) ? floatval($grp['min']) : 1.0; $max = isset($grp['max']) ? floatval($grp['max']) : 3.0; - echo ''; - echo ''; - echo 'Random radius in [min max] single option
'; + echo ''; + echo ''; + echo '' . esc_html__('Random radius in [min max] single option', 'yoone-snow') . '
'; }, 'yoone_snow', 'yoone_snow_section' @@ -799,13 +811,13 @@ function yoone_snow_register_settings() { )); add_settings_field( 'yoone_snow_drift_range', - 'Drift Speed Random Range', + esc_html__('Drift Speed Random Range', 'yoone-snow'), function() { $min = floatval(get_option('yoone_snow_drift_min', 0.4)); $max = floatval(get_option('yoone_snow_drift_max', 1.0)); - echo ''; - echo ''; - echo 'Random vertical drift speed base in [min max]
'; + echo ''; + echo ''; + echo '' . esc_html__('Random vertical drift speed base in [min max]', 'yoone-snow') . '
'; }, 'yoone_snow', 'yoone_snow_section' @@ -832,13 +844,13 @@ function yoone_snow_register_settings() { )); add_settings_field( 'yoone_snow_swing_range', - 'Swing Amplitude Random Range', + esc_html__('Swing Amplitude Random Range', 'yoone-snow'), function() { $min = floatval(get_option('yoone_snow_swing_min', 0.2)); $max = floatval(get_option('yoone_snow_swing_max', 1.0)); - echo ''; - echo ''; - echo 'Random horizontal swing amplitude base in [min max] before offset scale
'; + echo ''; + echo ''; + echo '' . esc_html__('Random horizontal swing amplitude base in [min max] before offset scale', 'yoone-snow') . '
'; }, 'yoone_snow', 'yoone_snow_section'