kelvinhokk / cordova-plugin-localization-strings

Cordova Plugin for Localization of Strings on the App
MIT License
119 stars 107 forks source link

Prepare fails on iOS with "Error: Cannot read properties of undefined (reading 'project')" #72

Closed pklaes closed 2 years ago

pklaes commented 2 years ago

Prepare fails on iOS with Error: Cannot read properties of undefined (reading 'project') when an optional short name is given in config.xml as specified in the Docs, e.g. <name short="Whatever">ACMEs cool Whatever App</name> This is because the optional short name is not recognized in the pattern matching in create_ios_strings.js.

Working on a pull request ...

rodrigograca31 commented 2 years ago

can you explain why this var matches = config.match(new RegExp('<name>(.*?)</name>', 'i')); wouldnt catch ACMEs cool Whatever App ???

pklaes commented 2 years ago

can you explain why this var matches = config.match(new RegExp('<name>(.*?)</name>', 'i')); wouldnt catch ACMEs cool Whatever App ???

Sure: The opening Tag<name short="Whatever"> is missing the closing > right after <name.

Of course we could combine the two regex into one, something along the line <name.*?>(.*?)</name> , but regex are hard, better be verbose, I thought.

Thanks anyway, closing this.

rodrigograca31 commented 2 years ago

yeah...... maybe a xml parser would be easier...... but like you said its another dependency...