Git Product home page Git Product logo

Comments (5)

iafan avatar iafan commented on September 13, 2024

Can you please share and example of the .strings file that I could use to reproduce the problem? (You can trim it down to just one or two problematic lines.)

from serge.

MPomeroy avatar MPomeroy commented on September 13, 2024

Of course, thanks for the prompt response.

From the base strings file:

/* Sample strings with escapes */
"dateslist.nothingdue" = "Nothing due.";
"dateslist.nothingdue.today" = "Nothing due today.";

From the french translation:

/* Sample strings with escapes */
"dateslist.nothingdue" = "Rien n\'est dû.";
"dateslist.nothingdue.today" = "Rien n\'est dû aujourd\'hui.";

from serge.

iafan avatar iafan commented on September 13, 2024

I can confirm that if one has \' in the translation, in the generated file it will be presented as \\'.

According to Apple's documentation one doesn't need to escape apostrophes:

Using Special Characters in String Resources

Just as in C, some characters must be prefixed with a backslash before you can include them in the string. These characters include double quotation marks, the backslash character itself, and special control characters such as linefeed (\n) and carriage returns (\r).

So if the above it's true, then what Serge currently does is kind of expected: it detects a backslash not followed by any of the special characters, and escapes it by itself.

So I guess my next question is: why do you have apostrophes escaped, and can you try simply converting some \' to ' and see if this change has any effect on your application? If it doesn't, it just makes sense to convert these once through all resources.

from serge.

iafan avatar iafan commented on September 13, 2024

I also checked our own iOS and macOS resource files, and we have these strings that work just fine:

"'%@' is not a valid email address." = "'%@' n'est pas une adresse email valide.";

from serge.

MPomeroy avatar MPomeroy commented on September 13, 2024

That makes perfect sense, I just tested it and our app builds fine without the escape characters. I'm not certain why they were included in the file in the first place...

I will do as you suggest and clean up the strings on my end. Thanks for looking into this!

from serge.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.