easy_localization icon indicating copy to clipboard operation
easy_localization copied to clipboard

RangeError (index): Invalid value: Only valid value is 0: -1

Open RanaMusab opened this issue 3 years ago • 13 comments

I am getting this issue after loading the CSV file The code is the same as you give an example

RanaMusab avatar Dec 09 '20 10:12 RanaMusab

Problem in your CSV, please find same issue

Overman775 avatar Dec 10 '20 16:12 Overman775

I have the same problem when using csv. Everything in csv seems to be ok. What else could be wrong?

deadsoul44 avatar Jan 14 '21 19:01 deadsoul44

I think we need a proper csv editor or extension to edit or create csv file

On Fri, Jan 15, 2021, 12:23 AM Mutlu Şimşek [email protected] wrote:

I have the same problem when using csv. Everything in csv seems to be ok. What else could be wrong?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/aissat/easy_localization/issues/296#issuecomment-760414911, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOBGGNYBGZIHWQQMPFF2BELSZ5AC7ANCNFSM4UTKBCPA .

RanaMusab avatar Jan 15 '21 06:01 RanaMusab

I keep getting this error. Is there any solution?

deadsoul44 avatar Jan 15 '21 18:01 deadsoul44

I had to modify the source code of CsvAssetLoader:

  CSVParser(this.strings, {this.fieldDelimiter = ','})
      : lines = CsvToListConverter(csvSettingsDetector: FirstOccurrenceSettingsDetector(
    fieldDelimiters: [',', ';'],
    textDelimiters: ['"', "'"],
    textEndDelimiters: ['"', "'"],
    eols: ['\r\n', '\n'],
  ),)
      .convert(strings, fieldDelimiter: fieldDelimiter);

deadsoul44 avatar Jan 15 '21 19:01 deadsoul44

FirstOccurrenceSettingsDetector parameters should be promoted to CsvAssetLoader. Currently, I had to modify the source code of CsvAssetLoader due to this.

deadsoul44 avatar Jan 16 '21 19:01 deadsoul44

@deadsoul44 Your problem is in the csv file Make sure that the English language is present "en" and that the language name is correct Like("en_US, en_UK , ar_DZ, ar_LB...)

mstfkhazaal avatar Sep 10 '22 15:09 mstfkhazaal

@deadsoul44 Your problem is in the csv file Make sure that the English language is present "en" and that the language name is correct Like("en_US, en_UK , ar_DZ, ar_LB...)

My file looks good here, but i am still facing the problem. @mstfkhazaal .. can you help?

Screenshot 2022-09-14 at 4 53 01 PM Screenshot 2022-09-14 at 4 54 08 PM

ch-muhammad-adil avatar Sep 14 '22 11:09 ch-muhammad-adil

@ch-muhammad-adil add to csv file en de column

mstfkhazaal avatar Sep 14 '22 11:09 mstfkhazaal

@ch-muhammad-adil add to csv file en de column Like

key,en ,en_US, de, de_DE home, Home,Home,Heim,Heim ....

mstfkhazaal avatar Sep 14 '22 11:09 mstfkhazaal

I see problem comes when i use useFallbackTranslations: true, below. If i remove that then it works fine .. @mstfkhazaal

supportedLocales: [Locale('en', 'US'), Locale('de', 'DE')],
     path: 'assets/localization/alp_localization.csv',
     fallbackLocale: Locale('en', 'US'),
     startLocale: Locale('en', 'US'),
     assetLoader: CsvAssetLoader(),
     useFallbackTranslations: true,

ch-muhammad-adil avatar Sep 14 '22 11:09 ch-muhammad-adil

Thank you for quick response @mstfkhazaal , so problem was useFallbackTranslations: true, not sure what connection it has here.

ch-muhammad-adil avatar Sep 14 '22 12:09 ch-muhammad-adil

When you use useFallbackTranslations: true, you are forced to add the original language

mstfkhazaal avatar Sep 14 '22 12:09 mstfkhazaal