-
Notifications
You must be signed in to change notification settings - Fork 83
Add support for Xcode String Catalog #148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
lib/babelish/commandline.rb
Outdated
|
|
||
| BASECLASSES = [ | ||
| {:name => "Strings2CSV", :ext => ".strings"}, | ||
| {:name => "XCStrings2CSV", :ext => ".xcstrings"}, |
There was a problem hiding this comment.
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.
lib/babelish/commandline.rb
Outdated
|
|
||
| CSVCLASSES = [ | ||
| {:name => "CSV2Strings", :ext => ".strings"}, | ||
| {:name => "CSV2XCStrings", :ext => ".xcstrings"}, |
There was a problem hiding this comment.
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.
lib/babelish/csv2base.rb
Outdated
| @@ -1,4 +1,5 @@ | |||
| require 'pathname' | |||
| require 'thor' | |||
There was a problem hiding this comment.
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.
lib/babelish/csv2xcstrings.rb
Outdated
| "" | ||
| end | ||
| end | ||
| end No newline at end of file |
There was a problem hiding this comment.
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.
lib/babelish/csv2xcstrings.rb
Outdated
| source_lang | ||
| end | ||
|
|
||
| def hash_to_output(content = {}) |
There was a problem hiding this comment.
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.
lib/babelish/csv2xcstrings.rb
Outdated
| source_lang = 'en' | ||
| break | ||
| elsif language.code == 'en' || language.code&.start_with?('en-') | ||
| source_lang = 'en' |
There was a problem hiding this comment.
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.
lib/babelish/csv2xcstrings.rb
Outdated
| if language.regions.any? { |code| code == 'en' || code.start_with?('en-') } | ||
| source_lang = 'en' | ||
| break | ||
| elsif language.code == 'en' || language.code&.start_with?('en-') |
There was a problem hiding this comment.
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.
lib/babelish/csv2xcstrings.rb
Outdated
| next if language.nil? | ||
|
|
||
| if language.regions.any? { |code| code == 'en' || code.start_with?('en-') } | ||
| source_lang = 'en' |
There was a problem hiding this comment.
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.
lib/babelish/csv2xcstrings.rb
Outdated
| @languages.each do |language| | ||
| next if language.nil? | ||
|
|
||
| if language.regions.any? { |code| code == 'en' || code.start_with?('en-') } |
There was a problem hiding this comment.
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]
lib/babelish/csv2xcstrings.rb
Outdated
|
|
||
| @languages.each do |language| | ||
| next if language.nil? | ||
|
|
There was a problem hiding this comment.
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" | |||
There was a problem hiding this comment.
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? } |
There was a problem hiding this comment.
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") } |
There was a problem hiding this comment.
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-") } |
There was a problem hiding this comment.
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 | ||
|
|
There was a problem hiding this comment.
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 | ||
|
|
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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? | ||
|
|
There was a problem hiding this comment.
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? | ||
|
|
There was a problem hiding this comment.
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? | ||
|
|
There was a problem hiding this comment.
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.
This PR adds support for the new Xcode String Catalog which is available since Xcode 15.