设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 323|回复: 7
打印 上一主题 下一主题

[已经解决] 我想请教一下文本汉化后出现的问题

[复制链接]

Lv2.观梦者

梦石
0
星屑
339
在线时间
19 小时
注册时间
2010-7-17
帖子
12
跳转到指定楼层
1
发表于 2023-12-29 00:59:05 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有帐号?注册会员

x
本帖最后由 红泥杂货铺 于 2023-12-29 01:20 编辑

这是英文原文
You can talk to \C[18]Faun Princess\C[0] to rest in her Tavern or to leave your party members in her care.

游戏内是这样显示的

然后这是中文翻译的
你可以与 \C[18]法恩公主\C[0] 交谈,以在她的酒馆休息或将你的队友交给她照顾。

游戏内显示就成这样了


请问这是字体问题还是翻译文本的问题,我发现\C或者\i 都有几率变成这样前面的

QQ截图20231229010929.png (207.28 KB, 下载次数: 19)

QQ截图20231229010929.png

Lv2.观梦者

梦石
0
星屑
339
在线时间
19 小时
注册时间
2010-7-17
帖子
12
2
 楼主| 发表于 2023-12-29 01:29:20 | 只看该作者
本帖最后由 红泥杂货铺 于 2023-12-29 01:32 编辑

试验了下是文本的问题但是不知道哪里出问题了




三段文本分别是
You can talk to \C[18]Faun Princess\C[0] to rest in her Tavern or to leave your party members in her care.
你可以与 \C[18]Faun Princess\C[0] 交谈,以在她的酒馆休息或将你的队友交给她照顾。
You can talk to  \C[18]法恩公主\C[0] to rest in her Tavern or to leave your party members in her care.
我试过把英文版的复制过去然后把中间改成中文结果跟第二次一样
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
339
在线时间
19 小时
注册时间
2010-7-17
帖子
12
3
 楼主| 发表于 2023-12-29 03:55:13 | 只看该作者
找到原因了是它自带的英文版的换行脚本,效果还挺好的如果字体超过了页码的话会开一个新的页码,问题是会把中文输入的\C \I啥的给直接跳过一行
本人对脚本实际上一窍不通的,希望能有大佬能帮俺改一下方便中文使用
#========================================================================
# ** Word Wrapping Message Boxes, by: KilloZapit
#------------------------------------------------------------------------
# Changes message boxes so it will automatically wrap long lines.
#
# Note: I consider this script to be public domain, and put no
# restrictions on it's use whatsoever. My only request is that
# a link back to the script is provided so more people can
# access it if they want to.
#
# Version the Second:
#   Now strips color codes and icon codes so they don't break words.
#   Also calculates icon width along with text width for words.
# Version the Third:
#   Now also strips delays and other timing related codes.
#   Splits for non-icon control codes before counting icons.
#   Control codes can now break lines in case of font changes.
#   Added some comments to clarify some code.
# Version the Forth:
#   Fixed a small bug that might cause a error when counting icons.
#   Added a small notice for copyright questions.
# Version the Fifth:
#   Added "collapse" mode, which elimanates extra spaces.
#   Can now use "whitespace" mode outside of wordwrap mode if needed.
# Version the Sixth:
#   Fixed problems with collapsed whitespace not wraping words right.
# Version the Seventh:
#   Added option to add a margin to the right hand side of the window.
#------------------------------------------------------------------------
# Also adds the following new escape sequences:
#
# \ww  - Word Wrap: turns word wrap on if it's off
# \nw  - No Wrap: Turns word wrap off
# \ws  - WhiteSpace mode: Converts newlines to spaces (like HTML)
# \nl  - New Line: Preserves hard returns
# \cs  - Collapse whiteSpace: Eliminates extra spaces (also like HTML)
# \pre - PRE-formatted: Preserves spaces
# \br  - line BRake: manual newline for whitespace mode
# \rm  - Right Margin: extra space on the right side of the window
#========================================================================

# Standard config module.
module KZIsAwesome
  module WordWrap

    # change this if you don't want wordwrap on by default.
    DEFAULT_WORDWRAP = true

    # change this if you want white space mode on by default.
    DEFAULT_WHITESPACE = false
   
    # change this if you want white space mode on by default.
    DEFAULT_COLLAPSE = true
   
    # change this to add a right margin to the window.
    DEFAULT_RIGHT_MARGIN = 0
  end
end

class Window_Base < Window
  include KZIsAwesome::WordWrap

  alias_method :initialize_kz_window_base, :initialize
  def initialize(x, y, width, height)
    initialize_kz_window_base(x, y, width, height)
    @wordwrap = DEFAULT_WORDWRAP
    @convert_newlines = DEFAULT_WHITESPACE
    @collapse_whitespace = DEFAULT_COLLAPSE
    @right_margin = DEFAULT_RIGHT_MARGIN
    @lastc = "\n"
  end

  alias_method :process_character_kz_window_base, :process_character
  def process_character(c, text, pos)
    c = ' ' if @convert_newlines && c == "\n"
    if @wordwrap && c =~ /[ \t]/
      c = '' if @collapse_whitespace && @lastc =~ /[\s\n\f]/
      if pos[:x] + get_next_word_size(c, text) > contents.width - @right_margin
        process_new_line(text, pos)
      else
        process_normal_character(c, pos)
      end
      @lastc = c
    else
      @lastc = c
      process_character_kz_window_base(c, text, pos)
    end
  end

  def get_next_word_size(c, text)
    # Split text by the next space/line/page and grab the first split
    nextword = text.split(/[\s\n\f]/, 2)[0]
    if nextword
      icons = 0
      if nextword =~ /\e/i
        # Get rid of color codes and YEA Message system outline colors
        nextword = nextword.split(/\e[oOcC]+\[\d*\]/).join
        # Get rid of message timing control codes
        nextword = nextword.split(/\e[\.\|\^<>!]/).join
        # Split text by the first non-icon escape code
        # (the hH is for compatibility with the Icon Hues script)
        nextword = nextword.split(/\e[^iIhH]+/, 2)[0]
        # Erase and count icons in remaining text
        nextword.gsub!(/\e[iIhH]+\[[\d,]*\]/) do
          icons += 1
          ''
        end if nextword
      end
      wordsize = (nextword ? text_size(c + nextword).width : text_size( c ).width)
      wordsize += icons * 24
    else
      wordsize = text_size( c ).width
    end
    return wordsize
  end

  alias_method :process_escape_character_kz_window_base, :process_escape_character
  def process_escape_character(code, text, pos)
    case code.upcase
    when 'WW'
      @wordwrap = true
    when 'NW'
      @wordwrap = false
    when 'WS'
      @convert_newlines = true
    when 'NL'
      @convert_newlines = false
    when 'CS'
      @collapse_whitespace = true
    when 'PRE'
      @collapse_whitespace = false
    when 'BR'
      process_new_line(text, pos)
      @lastc = "\n"
    when 'RM'
      @right_margin = obtain_escape_param(text)
    else
      process_escape_character_kz_window_base(code, text, pos)
    end
    # Recalculate the next word size and insert line breaks
    # (Needed primarily for font changes)
    if pos[:x] + get_next_word_size('', text) > contents.width
      process_new_line(text, pos)
    end
  end

end
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
339
在线时间
19 小时
注册时间
2010-7-17
帖子
12
4
 楼主| 发表于 2023-12-29 11:37:29 | 只看该作者
不对啊,我问了半天chatgpt都没整明白他为啥会换行

这是一段文本测试,文本只中只要包含过长的文本和\C[18]变色字体\C[0]无论是文本前段还是文本后端文本量超出一定额度就会自动换行
这是原始文本
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1247
在线时间
65 小时
注册时间
2023-3-12
帖子
57
5
发表于 2023-12-29 11:57:23 | 只看该作者
应该是空格换行吧,英文换行最常见的换行方式。你把空格删干净试试
云书2群:976623094
欢迎加群学习~
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
339
在线时间
19 小时
注册时间
2010-7-17
帖子
12
6
 楼主| 发表于 2023-12-29 12:17:31 | 只看该作者
千寒-YuukakeID 发表于 2023-12-29 11:57
应该是空格换行吧,英文换行最常见的换行方式。你把空格删干净试试

没用,把自动换行删了用喵呜喵5的就正常了,他这个换行跟空格好像没关系删不删都会换行关键词不明因为如果文本没有超过一定长度他不会换行。
举个例子就是:
测试文本\C[18]变色字体\C[0]测试
这种短长度的就正常
回复 支持 反对

使用道具 举报

Lv5.捕梦者 (暗夜天使)

只有笨蛋才会看到

梦石
1
星屑
20965
在线时间
9334 小时
注册时间
2012-6-19
帖子
7106

开拓者短篇九导演组冠军

7
发表于 2023-12-29 14:17:43 | 只看该作者
从代码来看,他的换行采用的是英文换行的规则,即自动换行时尽量不拆散单词,而中文没有单词这个概念,因此他将后半段没有空格的那个文本当成了一个完整的单词因此进行了强制换行
脚本设置里有个 DEFAULT_WORDWRAP = true 的设置,可以改成 false 试试

或者就是用我的自动换行
回复 支持 反对

使用道具 举报

Lv2.观梦者

梦石
0
星屑
339
在线时间
19 小时
注册时间
2010-7-17
帖子
12
8
 楼主| 发表于 2023-12-29 15:02:13 | 只看该作者
喵呜喵5 发表于 2023-12-29 14:17
从代码来看,他的换行采用的是英文换行的规则,即自动换行时尽量不拆散单词,而中文没有单词这个概念,因此 ...

直接用了您的自动换行,真鸡儿好使!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-4-29 14:55

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表