-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add --use-one-line-per-reference option
- Loading branch information
Showing
33 changed files
with
208 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (C) 2012-2019 Sutou Kouhei <[email protected]> | ||
# Copyright (C) 2012-2023 Sutou Kouhei <[email protected]> | ||
# Copyright (C) 2010 masone (Christian Felder) <[email protected]> | ||
# Copyright (C) 2009 Masao Mutoh | ||
# | ||
|
@@ -282,6 +282,9 @@ def escape(string) | |
# Wraps long lines that is longer than the `:max_line_width`. | ||
# Don't break long lines if `:max_line_width` is less than 0 | ||
# such as `-1`. | ||
# @option options [Bool] :use_one_line_per_reference (false) | ||
# Whether each reference comment uses one line or not. If this | ||
# is `true`, `:max_line_width` is ignored for reference comment. | ||
# @option options [Encoding] :encoding (nil) | ||
# Encodes to the specific encoding. | ||
def initialize(entry, options={}) | ||
|
@@ -405,24 +408,29 @@ def format_extracted_comment | |
end | ||
|
||
def format_reference_comment | ||
max_line_width = @options[:max_line_width] | ||
formatted_reference = String.new | ||
if not @entry.references.nil? and not @entry.references.empty? | ||
formatted_reference << REFERENCE_COMMENT_MARK | ||
line_width = 2 | ||
@entry.references.each do |reference| | ||
if max_line_width > 0 and | ||
if @options[:use_one_line_per_reference] | ||
@entry.references&.each do |reference| | ||
formatted_reference << "#{REFERENCE_COMMENT_MARK} #{reference}\n" | ||
end | ||
else | ||
max_line_width = @options[:max_line_width] | ||
if not @entry.references.nil? and not @entry.references.empty? | ||
formatted_reference << REFERENCE_COMMENT_MARK | ||
line_width = 2 | ||
@entry.references.each do |reference| | ||
if max_line_width > 0 and | ||
line_width + reference.size > max_line_width | ||
formatted_reference << "\n" | ||
formatted_reference << "#{REFERENCE_COMMENT_MARK} #{reference}" | ||
line_width = 3 + reference.size | ||
else | ||
formatted_reference << " #{reference}" | ||
line_width += 1 + reference.size | ||
formatted_reference << "\n" | ||
formatted_reference << "#{REFERENCE_COMMENT_MARK} #{reference}" | ||
line_width = 3 + reference.size | ||
else | ||
formatted_reference << " #{reference}" | ||
line_width += 1 + reference.size | ||
end | ||
end | ||
formatted_reference << "\n" | ||
end | ||
|
||
formatted_reference << "\n" | ||
end | ||
formatted_reference | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# Copyright (C) 2014-2017 Kouhei Sutou <[email protected]> | ||
# Copyright (C) 2014-2023 Sutou Kouhei <[email protected]> | ||
# | ||
# License: Ruby's or LGPL | ||
# | ||
|
@@ -200,7 +200,8 @@ def initialize | |
@output = nil | ||
@order = nil | ||
@po_format_options = { | ||
:max_line_width => POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH, | ||
max_line_width: POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH, | ||
use_one_line_per_reference: false, | ||
} | ||
@include_fuzzy = true | ||
@report_warning = true | ||
|
@@ -322,6 +323,12 @@ def create_option_parser | |
@po_format_options[:max_line_width] = max_line_width | ||
end | ||
|
||
parser.on("--[no-]use-one-line-per-reference", | ||
_("Use one line for each reference comment"), | ||
"(#{@po_format_options[:use_one_line_per_reference]})") do |use| | ||
@po_format_options[:use_one_line_per_reference] = use | ||
end | ||
|
||
parser.on("--no-fuzzy", | ||
_("Ignore fuzzy entries")) do |include_fuzzy| | ||
@include_fuzzy = include_fuzzy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,7 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2012-2013 Haruka Yoshihara <[email protected]> | ||
# Copyright (C) 2012-2015 Kouhei Sutou <[email protected]> | ||
# Copyright (C) 2005-2009 Masao Mutoh | ||
# Copyright (C) 2005,2006 speakillof | ||
# Copyright (C) 2012-2023 Sutou Kouhei <[email protected]> | ||
# Copyright (C) 2005-2009 Masao Mutoh | ||
# Copyright (C) 2005,2006 speakillof | ||
# | ||
# License: Ruby's or LGPL | ||
# | ||
|
@@ -310,7 +308,8 @@ def initialize | |
@output = nil | ||
@order = :reference | ||
@po_format_options = { | ||
:max_line_width => POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH, | ||
max_line_width: POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH, | ||
use_one_line_per_reference: false, | ||
} | ||
@enable_fuzzy_matching = true | ||
@update = nil | ||
|
@@ -424,6 +423,12 @@ def create_option_parser | |
@po_format_options[:max_line_width] = max_line_width | ||
end | ||
|
||
parser.on("--[no-]use-one-line-per-reference", | ||
_("Use one line for each reference comment"), | ||
"(#{@po_format_options[:use_one_line_per_reference]})") do |use| | ||
@po_format_options[:use_one_line_per_reference] = use | ||
end | ||
|
||
parser.on("--[no-]fuzzy-matching", | ||
_("Disable fuzzy matching"), | ||
_("(enable)")) do |boolean| | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2012 Haruka Yoshihara <[email protected]> | ||
# Copyright (C) 2012-2014 Kouhei Sutou <[email protected]> | ||
# Copyright (C) 2012-2023 Sutou Kouhei <[email protected]> | ||
# Copyright (C) 2003-2010 Masao Mutoh | ||
# Copyright (C) 2001,2002 Yasushi Shoji, Masao Mutoh | ||
# | ||
|
@@ -90,7 +88,8 @@ def initialize #:nodoc: | |
|
||
@po_order = :references | ||
@po_format_options = { | ||
:max_line_width => POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH, | ||
max_line_width: POEntry::Formatter::DEFAULT_MAX_LINE_WIDTH, | ||
use_one_line_per_reference: false, | ||
} | ||
end | ||
|
||
|
@@ -325,6 +324,12 @@ def parse_arguments(*options) #:nodoc: | |
@po_format_options[:max_line_width] = max_line_width | ||
end | ||
|
||
parser.on("--[no-]use-one-line-per-reference", | ||
_("Use one line for each reference comment"), | ||
"(#{@po_format_options[:use_one_line_per_reference]})") do |use| | ||
@po_format_options[:use_one_line_per_reference] = use | ||
end | ||
|
||
parser.on("-r", "--require=library", | ||
_("require the library before executing xgettext")) do |out| | ||
require out | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ msgid "" | |
msgstr "" | ||
"Project-Id-Version: gettext 2.3.1\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2022-05-20 19:57+0900\n" | ||
"PO-Revision-Date: 2023-10-22 06:40+0900\n" | ||
"Last-Translator: Haruka Yoshihara <[email protected]>\n" | ||
"Language-Team: Japanese\n" | ||
"Language: ja\n" | ||
|
@@ -78,6 +78,9 @@ msgid "" | |
"s" | ||
msgstr "メッセージ中の出力ページ幅より長い行を複数行に分割" | ||
|
||
msgid "Use one line for each reference comment" | ||
msgstr "1行に1つのリファレンスコメントだけを入れる\n" | ||
|
||
msgid "Ignore fuzzy entries" | ||
msgstr "fuzzyエントリーを無視" | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.