AckeeCZ / ACKLocalization

Localize your Cocoa apps from Google Spreadsheet
MIT License
28 stars 3 forks source link

🐛 Fix bug in function for removing suffix from string #39

Closed vendulasvastal closed 11 months ago

vendulasvastal commented 11 months ago

Hi guys 👋

This PR fixes a small bug which would generate Localization..strings file instead of Localization.strings file when using the following configuration:

{
    "defaultFileName": "Localization.string",
    ....
}

The current setup seems to still support default file names with their extension included: https://github.com/AckeeCZ/ACKLocalization/blob/afd8e35a9d52c8f37f488921cf502b141547dd46/Sources/ACKLocalizationCore/ACKLocalization.swift#L206.

However, it only works properly if no extension is included ("defaultFileName": "Localization" as in the example in README). If extension is specified a file with double dot is generated. This is due to the removingSuffix function only removing suffix.count-1 last characters of the string instead of suffix.count which I think is unexpected.

Checklist

olejnjak commented 11 months ago

Released in 1.6.1 ✅🙂