@@ -0,0 +1,25 | |||||
|
1 | # HG changeset patch | |||
|
2 | # User tmaruyama | |||
|
3 | # Date 1362559296 0 | |||
|
4 | # Node ID ee54942e0289c30bea1b1973750b698b1ee7c466 | |||
|
5 | # Parent 738777832f379f6f099c25251593fc57bc17f586 | |||
|
6 | fix some Japanese "issue" translations (#13350) | |||
|
7 | ||||
|
8 | Contributed by Go MAEDA. | |||
|
9 | ||||
|
10 | diff --git a/config/locales/ja.yml b/config/locales/ja.yml | |||
|
11 | --- a/config/locales/ja.yml | |||
|
12 | +++ b/config/locales/ja.yml | |||
|
13 | @@ -904,9 +904,9 @@ ja: | |||
|
14 | text_journal_set_to: "%{label} を %{value} にセット" | |||
|
15 | text_journal_deleted: "%{label} を削除 (%{old})" | |||
|
16 | text_journal_added: "%{label} %{value} を追加" | |||
|
17 | - text_tip_issue_begin_day: この日に開始するタスク | |||
|
18 | - text_tip_issue_end_day: この日に終了するタスク | |||
|
19 | - text_tip_issue_begin_end_day: この日のうちに開始して終了するタスク | |||
|
20 | + text_tip_issue_begin_day: この日に開始するチケット | |||
|
21 | + text_tip_issue_end_day: この日に終了するチケット | |||
|
22 | + text_tip_issue_begin_end_day: この日に開始・終了するチケット | |||
|
23 | text_caracters_maximum: "最大%{count}文字です。" | |||
|
24 | text_caracters_minimum: "最低%{count}文字の長さが必要です" | |||
|
25 | text_length_between: "長さは%{min}から%{max}文字までです。" |
@@ -0,0 +1,19 | |||||
|
1 | # HG changeset patch | |||
|
2 | # User tmaruyama | |||
|
3 | # Date 1355872765 0 | |||
|
4 | # Node ID 8a13ebed1779c2e85fa644ecdd0de81996c969c4 | |||
|
5 | # Parent 5c3c5f917ae92f278fe42c6978366996595b0796 | |||
|
6 | Russian "about_x_hours" translation changed by Mikhail Velkin (#12640) | |||
|
7 | ||||
|
8 | diff --git a/config/locales/ru.yml b/config/locales/ru.yml | |||
|
9 | --- a/config/locales/ru.yml | |||
|
10 | +++ b/config/locales/ru.yml | |||
|
11 | @@ -115,7 +115,7 @@ ru: | |||
|
12 | one: "около %{count} часа" | |||
|
13 | few: "около %{count} часов" | |||
|
14 | many: "около %{count} часов" | |||
|
15 | - other: "около %{count} часа" | |||
|
16 | + other: "около %{count} часов" | |||
|
17 | x_hours: | |||
|
18 | one: "1 час" | |||
|
19 | other: "%{count} часов" |
@@ -10,7 +10,7 | |||||
10 | <thead> |
|
10 | <thead> | |
11 | <tr> |
|
11 | <tr> | |
12 | <th colspan="4" class="filename"> |
|
12 | <th colspan="4" class="filename"> | |
13 | <%= h(Redmine::CodesetUtil.to_utf8_by_setting(table_file.file_name)) %> |
|
13 | <%= table_file.file_name %> | |
14 | </th> |
|
14 | </th> | |
15 | </tr> |
|
15 | </tr> | |
16 | </thead> |
|
16 | </thead> | |
@@ -24,11 +24,11 | |||||
24 | <tr> |
|
24 | <tr> | |
25 | <th class="line-num"><%= line.nb_line_left %></th> |
|
25 | <th class="line-num"><%= line.nb_line_left %></th> | |
26 | <td class="line-code <%= line.type_diff_left %>"> |
|
26 | <td class="line-code <%= line.type_diff_left %>"> | |
27 |
<pre><%= |
|
27 | <pre><%= line.html_line_left.html_safe %></pre> | |
28 | </td> |
|
28 | </td> | |
29 | <th class="line-num"><%= line.nb_line_right %></th> |
|
29 | <th class="line-num"><%= line.nb_line_right %></th> | |
30 | <td class="line-code <%= line.type_diff_right %>"> |
|
30 | <td class="line-code <%= line.type_diff_right %>"> | |
31 |
<pre><%= |
|
31 | <pre><%= line.html_line_right.html_safe %></pre> | |
32 | </td> |
|
32 | </td> | |
33 | </tr> |
|
33 | </tr> | |
34 | <% end -%> |
|
34 | <% end -%> | |
@@ -40,7 +40,7 | |||||
40 | <thead> |
|
40 | <thead> | |
41 | <tr> |
|
41 | <tr> | |
42 | <th colspan="3" class="filename"> |
|
42 | <th colspan="3" class="filename"> | |
43 |
<%= |
|
43 | <%= table_file.file_name %> | |
44 | </th> |
|
44 | </th> | |
45 | </tr> |
|
45 | </tr> | |
46 | </thead> |
|
46 | </thead> | |
@@ -55,7 +55,7 | |||||
55 | <th class="line-num"><%= line.nb_line_left %></th> |
|
55 | <th class="line-num"><%= line.nb_line_left %></th> | |
56 | <th class="line-num"><%= line.nb_line_right %></th> |
|
56 | <th class="line-num"><%= line.nb_line_right %></th> | |
57 | <td class="line-code <%= line.type_diff %>"> |
|
57 | <td class="line-code <%= line.type_diff %>"> | |
58 |
<pre><%= |
|
58 | <pre><%= line.html_line.html_safe %></pre> | |
59 | </td> |
|
59 | </td> | |
60 | </tr> |
|
60 | </tr> | |
61 | <% end -%> |
|
61 | <% end -%> |
@@ -28,17 +28,9 module Redmine | |||||
28 | lines = 0 |
|
28 | lines = 0 | |
29 | @truncated = false |
|
29 | @truncated = false | |
30 | diff_table = DiffTable.new(diff_type, diff_style) |
|
30 | diff_table = DiffTable.new(diff_type, diff_style) | |
31 | diff.each do |line| |
|
31 | diff.each do |line_raw| | |
32 | line_encoding = nil |
|
32 | line = Redmine::CodesetUtil.to_utf8_by_setting(line_raw) | |
33 | if line.respond_to?(:force_encoding) |
|
33 | unless diff_table.add_line(line) | |
34 | line_encoding = line.encoding |
|
|||
35 | # TODO: UTF-16 and Japanese CP932 which is imcompatible with ASCII |
|
|||
36 | # In Japan, diffrence between file path encoding |
|
|||
37 | # and file contents encoding is popular. |
|
|||
38 | line.force_encoding('ASCII-8BIT') |
|
|||
39 | end |
|
|||
40 | unless diff_table.add_line line |
|
|||
41 | line.force_encoding(line_encoding) if line_encoding |
|
|||
42 | self << diff_table if diff_table.length > 0 |
|
34 | self << diff_table if diff_table.length > 0 | |
43 | diff_table = DiffTable.new(diff_type, diff_style) |
|
35 | diff_table = DiffTable.new(diff_type, diff_style) | |
44 | end |
|
36 | end | |
@@ -207,10 +199,16 module Redmine | |||||
207 | while starting < max && line_left[starting] == line_right[starting] |
|
199 | while starting < max && line_left[starting] == line_right[starting] | |
208 | starting += 1 |
|
200 | starting += 1 | |
209 | end |
|
201 | end | |
|
202 | while line_left[starting].ord.between?(128, 191) && starting > 0 | |||
|
203 | starting -= 1 | |||
|
204 | end | |||
210 | ending = -1 |
|
205 | ending = -1 | |
211 | while ending >= -(max - starting) && line_left[ending] == line_right[ending] |
|
206 | while ending >= -(max - starting) && line_left[ending] == line_right[ending] | |
212 | ending -= 1 |
|
207 | ending -= 1 | |
213 | end |
|
208 | end | |
|
209 | while line_left[ending].ord.between?(128, 191) && ending > -1 | |||
|
210 | ending -= 1 | |||
|
211 | end | |||
214 | unless starting == 0 && ending == -1 |
|
212 | unless starting == 0 && ending == -1 | |
215 | [starting, ending] |
|
213 | [starting, ending] | |
216 | end |
|
214 | end | |
@@ -268,6 +266,12 module Redmine | |||||
268 | private |
|
266 | private | |
269 |
|
267 | |||
270 | def line_to_html(line, offsets) |
|
268 | def line_to_html(line, offsets) | |
|
269 | html = line_to_html_raw(line, offsets) | |||
|
270 | html.force_encoding('UTF-8') if html.respond_to?(:force_encoding) | |||
|
271 | html | |||
|
272 | end | |||
|
273 | ||||
|
274 | def line_to_html_raw(line, offsets) | |||
271 | if offsets |
|
275 | if offsets | |
272 | s = '' |
|
276 | s = '' | |
273 | unless offsets.first == 0 |
|
277 | unless offsets.first == 0 |
@@ -221,6 +221,29 DIFF | |||||
221 | assert_equal "test02.txt", diff[0].file_name |
|
221 | assert_equal "test02.txt", diff[0].file_name | |
222 | end |
|
222 | end | |
223 |
|
223 | |||
|
224 | def test_utf8_ja | |||
|
225 | ja = " text_tip_issue_end_day: " | |||
|
226 | ja += "\xe3\x81\x93\xe3\x81\xae\xe6\x97\xa5\xe3\x81\xab\xe7\xb5\x82\xe4\xba\x86\xe3\x81\x99\xe3\x82\x8b<span>\xe3\x82\xbf\xe3\x82\xb9\xe3\x82\xaf</span>" | |||
|
227 | ja.force_encoding('UTF-8') if ja.respond_to?(:force_encoding) | |||
|
228 | with_settings :repositories_encodings => '' do | |||
|
229 | diff = Redmine::UnifiedDiff.new(read_diff_fixture('issue-12641-ja.diff'), :type => 'inline') | |||
|
230 | assert_equal 1, diff.size | |||
|
231 | assert_equal 12, diff.first.size | |||
|
232 | assert_equal ja, diff.first[4].html_line_left | |||
|
233 | end | |||
|
234 | end | |||
|
235 | ||||
|
236 | def test_utf8_ru | |||
|
237 | ru = " other: "\xd0\xbe\xd0\xba\xd0\xbe\xd0\xbb\xd0\xbe %{count} \xd1\x87\xd0\xb0\xd1\x81<span>\xd0\xb0</span>"" | |||
|
238 | ru.force_encoding('UTF-8') if ru.respond_to?(:force_encoding) | |||
|
239 | with_settings :repositories_encodings => '' do | |||
|
240 | diff = Redmine::UnifiedDiff.new(read_diff_fixture('issue-12641-ru.diff'), :type => 'inline') | |||
|
241 | assert_equal 1, diff.size | |||
|
242 | assert_equal 8, diff.first.size | |||
|
243 | assert_equal ru, diff.first[3].html_line_left | |||
|
244 | end | |||
|
245 | end | |||
|
246 | ||||
224 | private |
|
247 | private | |
225 |
|
248 | |||
226 | def read_diff_fixture(filename) |
|
249 | def read_diff_fixture(filename) |
General Comments 0
You need to be logged in to leave comments.
Login now