Skip to content

Conversation

@4brunu
Copy link
Contributor

@4brunu 4brunu commented Aug 28, 2025

This PR adds support for the new Xcode String Catalog which is available since Xcode 15.


BASECLASSES = [
{:name => "Strings2CSV", :ext => ".strings"},
{:name => "XCStrings2CSV", :ext => ".xcstrings"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.


CSVCLASSES = [
{:name => "CSV2Strings", :ext => ".strings"},
{:name => "CSV2XCStrings", :ext => ".xcstrings"},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/SpaceInsideHashLiteralBraces: Space inside { missing.
Style/HashSyntax: Use the new Ruby 1.9 hash syntax.
Layout/SpaceInsideHashLiteralBraces: Space inside } missing.

@@ -1,4 +1,5 @@
require 'pathname'
require 'thor'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

""
end
end
end No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingBlankLines: Final newline missing.

source_lang
end

def hash_to_output(content = {})
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint/UnusedMethodArgument: Unused method argument - content. If it's necessary, use _ or _content as an argument name to indicate that it won't be used. You can also write as hash_to_output(*) if you want the method to accept any arguments but don't care about them.

source_lang = 'en'
break
elsif language.code == 'en' || language.code&.start_with?('en-')
source_lang = 'en'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

if language.regions.any? { |code| code == 'en' || code.start_with?('en-') }
source_lang = 'en'
break
elsif language.code == 'en' || language.code&.start_with?('en-')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

next if language.nil?

if language.regions.any? { |code| code == 'en' || code.start_with?('en-') }
source_lang = 'en'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.

@languages.each do |language|
next if language.nil?

if language.regions.any? { |code| code == 'en' || code.start_with?('en-') }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/StringLiterals: Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
Metrics/LineLength: Line is too long. [83/80]


@languages.each do |language|
next if language.nil?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

@@ -1,4 +1,5 @@
require 'pathname'
require "pathname"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style/FrozenStringLiteralComment: Missing magic comment # frozen_string_literal: true.

end

if source_lang == "en" && @languages.none? { |lang| lang&.code == "en" || lang&.regions&.include?("en") }
first_lang = @languages.detect { |lang| !lang.nil? && !lang.regions.empty? }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [84/80]

end
end

if source_lang == "en" && @languages.none? { |lang| lang&.code == "en" || lang&.regions&.include?("en") }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [111/80]

@languages.each do |language|
next if language.nil?

if language.regions.any? { |code| code == "en" || code.start_with?("en-") }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Metrics/LineLength: Line is too long. [83/80]

end

private

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

}
end
end

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.


localizations[lang_code] = {
"stringUnit" => {
"state" => "translated",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

else
lang_code = language.code
next if lang_code.nil?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

language.regions.each do |region|
lang_code = "#{language.code}-#{region}"
next if lang_code.nil?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.


value = language.content[key]
next if value.nil? || value.empty?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Layout/TrailingWhitespace: Trailing whitespace detected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants