//PUBLIC
 public void LoadFromText(string content)
 {
     LocalizationUtils.TryGetLocalizedEntriesFromJSONObject(JSONUtils.GetJSONFromString(content), out m_Entries, false);
 }
        private void GenerateDictionary(bool safeMode = true)
        {
            if (m_SupportedLanguages.Length == 0)
            {
                DebugUtils.LogError(this, "No supported languages, aborting generation!");
                return;
            }

            if (HasDuplicatedLanguages(out string duplicatedLanguage))
            {
                DebugUtils.LogError(this, "Found a duplicated language ID: " + DebugUtils.ToQuote(duplicatedLanguage) + " in supported languages, aborting generation!");
                return;
            }

            if (HasDuplicatedStrings(out string duplicatedString))
            {
                DebugUtils.LogError(this, "Found a duplicated string ID: " + DebugUtils.ToQuote(duplicatedString) + " in registered strings, aborting generation!");
                return;
            }

            if (JSONUtils.TryLoadFromPath(m_FilePath, out JSONObject dictionary, true))
            {
                //Start by parsing existing content from file
                if (LocalizationUtils.TryGetLocalizedEntriesFromJSONObject(dictionary, out LocalizedEntries dictionaryEntries, safeMode))
                {
                    //Adding new languages for existing strings
                    List <string> stringIDsToRemove = new List <string>();
                    foreach (string stringID in dictionaryEntries.Keys)
                    {
                        //Remove unsupported strings if needed
                        if (!IsStringSupported(stringID))
                        {
                            if (safeMode)
                            {
                                DebugUtils.LogWarning(this, "Found a non supported string ID: " + DebugUtils.ToQuote(stringID) + ". Please consider removing this entry.");
                            }
                            else
                            {
                                stringIDsToRemove.Add(stringID);
                                break;
                            }
                        }

                        List <string> missingLanguages = new List <string>();
                        foreach (LocalizedLanguage language in m_SupportedLanguages)
                        {
                            missingLanguages.Add(language.GetID());
                        }

                        List <string> languagesToRemove = new List <string>();
                        foreach (string languageID in dictionaryEntries[stringID].Keys)
                        {
                            if (IsLanguageSupported(languageID))
                            {
                                missingLanguages.Remove(languageID);
                            }
                            else
                            {
                                if (safeMode)
                                {
                                    DebugUtils.LogWarning(this, "Found a non supported language ID: " + DebugUtils.ToQuote(languageID) + " for string " + DebugUtils.ToQuote(stringID) + ". Please consider removing this entry.");
                                }
                                else
                                {
                                    languagesToRemove.Add(languageID);
                                }
                            }
                        }

                        //Remove unsupported languages if needed
                        foreach (string languageID in languagesToRemove)
                        {
                            dictionaryEntries[stringID].Remove(languageID);
                            DebugUtils.Log(this, "Removed a non supported language entry: " + DebugUtils.ToQuote(languageID) + " for string " + DebugUtils.ToQuote(stringID) + ".");
                        }

                        //Adding missing language entries
                        foreach (string languageID in missingLanguages)
                        {
                            if (!dictionaryEntries[stringID].ContainsKey(languageID))
                            {
                                dictionaryEntries[stringID][languageID] = "";
                            }
                        }
                    }

                    //Remove unsupported string Ids if needed
                    foreach (string stringID in stringIDsToRemove)
                    {
                        dictionaryEntries.Remove(stringID);
                        DebugUtils.Log(this, "Removed a non supported entry: " + DebugUtils.ToQuote(stringID) + ".");
                    }

                    //Adding missing entries
                    foreach (LocalizedStringData stringData in m_Strings)
                    {
                        if (!dictionaryEntries.ContainsKey(stringData.GetID()))
                        {
                            if (stringData.GetID() != "")
                            {
                                Dictionary <string, string> valuesByLanguage = new Dictionary <string, string>();
                                foreach (LocalizedLanguage language in m_SupportedLanguages)
                                {
                                    valuesByLanguage[language.GetID()] = "";
                                }
                                dictionaryEntries[stringData.GetID()] = valuesByLanguage;
                            }
                            else
                            {
                                DebugUtils.LogError(this, "Localized string \"" + stringData.name + "\" has no defined ID, aborting generation!");
                                return;
                            }
                        }
                    }

                    //Write dictionary back to file
                    if (BackupDictionary())
                    {
                        JSONUtils.WriteToPath(m_FilePath, LocalizationUtils.GetJSONObjectFromLocalizedEntries(dictionaryEntries), true);
                        ObjectUtils.TryCast(AssetDatabase.LoadAssetAtPath(m_FilePath, typeof(TextAsset)), out m_GeneratedDictionary);
                    }
                    else
                    {
                        DebugUtils.LogError(this, "Could not backup dictionary, aborting generation!");
                    }
                }