How to escape single quote in flutter's localization file?

548

As of i see we can 2 solutions,

  1. using "" quotes instaed ''
    String get modal => r"Tibo\'o";
    
  2. changing your code like
    String get variableName => 'Tibo\'o';
    
Share:
548
Admin
Author by

Admin

Updated on December 26, 2022

Comments

  • Admin
    Admin over 1 year

    I am creating dart's localisation file for my language by following flutter's Adding support for a new language. Unfortunately the file seems not to accept the usual escape character (\) for single quote (') that is frequently used in my language (see the screenshot below). What is the properly way to escape the character (') in this localization file?

    Dart's localization file

  • Admin
    Admin over 3 years
    Thank you @balaji-venkatraman The first solution removes the error.
  • Admin
    Admin over 3 years
    I still do not have enough reputation to upvote, sorry. On the other hand the solution works but I haven't been able to make the whole localization for a new language work.
  • Balaji Venkatraman
    Balaji Venkatraman over 3 years
    what is the issue that you are facing
  • Admin
    Admin over 3 years
    I followed the instruction the official flutter's Adding support for a new language to create locale for my language (nia for Nias). However flutter throws exception invalid locale, as flutter looks in the database of supported locales instead of checking the local file created above (NiaMaterialLocalizations.delegate). Still no idea how to progress. I hope to find any example other people from non-supported locales had done.