Exemple #1
0
 protected ExtendedTextFrame(string text, string description, LanguageCode language)
     : base()
 {
     this.Text=text;
     this.Description=description;
     this.Language=language;
 }
Exemple #2
0
 public UserLoginData(string u,string p,string tu,string tp,LanguageCode lang)
 {
     username = u;
     password = p;
     teacher_username = tu;
     teacher_password = tp;
     language = lang;
 }
 public void setUserDetails(string un,string ID,LanguageCode l)
 {
     username = un;
     userID = ID;
     language = l;
     state = 1;
     loading_status = new ConnectionError("Data assigned",RoutineStatus.IDLE);
 }
        /// <inheritdoc />
        public override T Load <T>(string assetName, LanguageCode language, bool useCache)
        {
            T data = base.Load <T>(assetName, language, useCache);

            if (data is Texture2D texture)
            {
                texture.Tag = this.Tag;
            }

            return(data);
        }
        private string GetCountryTranslatedName(ICountryInfo countryInfo, LanguageCode languageCode)
        {
            this._alpha2Code2CountryTranslation.TryGetValue(countryInfo.Alpha2Code, out var countryTranslation);

            if (countryTranslation.Translations != null && countryTranslation.Translations.Length > 0)
            {
                return(countryTranslation.Translations.Where(x => x.LanguageCode == languageCode).Select(x => x.Name).FirstOrDefault());
            }

            return(null);
        }
Exemple #6
0
        public static string LangCheck(string lang)
        {
            var temp = string.Empty;

            if (LanguageCode.TryGetValue(lang, out temp))
            {
                return(lang);                // if found
            }

            return("und");
        }
Exemple #7
0
    void Start()
    {
        m_LanguageManagerInstance.OnChangeLanguage += OnChangeLanguage;
        // Debug.Log(Application.systemLanguage.ToString());
        LanguageCode currentSystemLanguage = m_Languages.Find(p => p.name.Equals(Application.systemLanguage.ToString()));

        if (currentSystemLanguage != null)
        {
            ChangeLanguage(currentSystemLanguage.languageCode);
        }
    }
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///     Gets this instance.
        /// </summary>
        ///
        /// <param name="code">
        ///     the code.
        /// </param>
        /// <param name="page">
        ///     (Optional) the page.
        /// </param>
        /// <param name="size">
        ///     (Optional) the size.
        /// </param>
        ///
        /// <returns>
        ///     IReadOnlyList{ILanguageResource}.
        /// </returns>
        ///-------------------------------------------------------------------------------------------------
        public static IPagedList <ILanguageResource> Get(LanguageCode code, int page = 0, int size = 10)
        {
            ILanguageProvider provider = Container.TryGet <ILanguageProvider>();

            if (provider != null)
            {
                return(provider.Get(code, page, size));
            }

            return(PagedList <ILanguageResource> .Empty);
        }
Exemple #9
0
 public void SetLanguage(Guid?language)
 {
     this.languageId = language;
     if (language.HasValue)
     {
         var languageCache = resolveManager.Resolve <ILanguageCache>();
         var lang          = languageCache.GetByValue(language.Value);
         var lCode         = (LanguageCode)(Enum.Parse(typeof(LanguageCode), lang));
         this.languageCode = lCode;
     }
 }
Exemple #10
0
        public AnalysisDescriptor Resolve <T>(LanguageCode languageCode = LanguageCode.EN)
        {
            AnalysisDescriptor desciptor = null;

            if (typeof(T) == typeof(ElasticsearchJob))
            {
                desciptor = GetJobsAnalysisDescriptor(languageCode);
            }

            return(desciptor);
        }
        ///-------------------------------------------------------------------------------------------------
        /// <summary>
        ///     Gets a resource.
        /// </summary>
        ///
        /// <remarks>
        ///     Anwar Javed, 03/05/2014 5:08 PM.
        /// </remarks>
        ///
        /// <param name="key">
        ///     The key.
        /// </param>
        /// <param name="code">
        ///     (Optional) the code.
        /// </param>
        ///
        /// <returns>
        ///     The resource.
        /// </returns>
        ///-------------------------------------------------------------------------------------------------
        public static ILanguageResource GetResource(string key, LanguageCode code = LanguageCode.English)
        {
            ILanguageProvider provider = Container.TryGet <ILanguageProvider>();

            if (provider != null)
            {
                return(provider.Get(key, code));
            }

            return(null);
        }
Exemple #12
0
        override protected StageData CreateData(Dictionary <string, object> dict, DatabaseObject db,
                                                LanguageCode language)
        {
            var data = new StageData();

            data.Id          = ToString(dict["Id"]);
            data.Title_En    = ToString(dict["Title_En"]);
            data.Title_Ar    = ToString(dict["Title_Ar"]);
            data.Description = ToString(dict["Description"]);

            return(data);
        }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (LayoutId != null ? LayoutId.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LayoutVariant != null ? LayoutVariant.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (LanguageCode != null ? LanguageCode.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (CountryCode != null ? CountryCode.GetHashCode() : 0);
         return(hashCode);
     }
 }
Exemple #14
0
        public override int GetHashCode()
        {
            int hashCode = 0;

            unchecked {
                if (LanguageCode != null)
                {
                    hashCode += LanguageCode.GetHashCode();
                }
            }
            return(hashCode);
        }
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();
        Languege_Manager = LanguageManager.Getsingleton;

        Game_Languege = Languege_Manager.language;
        if (bf_language != Game_Languege)
        {
            Languege_Manager.SetLanguage(Game_Languege);
            bf_language = Game_Languege;
        }
    }
Exemple #16
0
        private static CodeTypeReference GetPrivateImplementationGenericType(LanguageCode language, string typeName, params string[] arguments)
        {
            if (typeName == null)
            {
                throw new ArgumentNullException("typeName");
            }
            if (arguments == null)
            {
                throw new ArgumentNullException("arguments");
            }
            if (arguments.Length == 0)
            {
                throw new ArgumentException(null, "arguments");
            }

            int indexOf = typeName.IndexOf('`');

            if (indexOf < 0)
            {
                indexOf = typeName.Length;
            }

            if (language == LanguageCode.CSharp)
            {
                string str = typeName.Substring(0, indexOf) + "<";
                for (int index = 0; index < arguments.Length; ++index)
                {
                    if (index > 0)
                    {
                        str += ",";
                    }

                    str += CodeDomUtilities.CreateCSharpEscapedIdentifier(arguments[index]);
                }
                return(new CodeTypeReference(str + ">"));
            }

            if (language == LanguageCode.VisualBasic)
            {
                string str1 = typeName.Substring(0, indexOf) + "(Of ";
                for (int index = 0; index < arguments.Length; ++index)
                {
                    if (index > 0)
                    {
                        str1 += ",";
                    }
                    str1 += CodeDomUtilities.CreateVisualBasicEscapedIdentifier(arguments[index]);
                }
                return(new CodeTypeReference((str1 + ")").Replace("(Of ", "_").Replace(")", "_")));
            }

            return(CodeDomUtilities.GetGenericType(typeName, arguments));
        }
Exemple #17
0
 public LocalizedTextDbProvider(ICurrentUser user
                                , ILocalizedTextRepository localizedTextRepository)
 {
     _user = user;
     if (_user != null && _user.HasValue())
     {
         _language = _user.UserSettings.LanguageId;
         _langName = ((int)_language).ToString();
     }
     _localizedTextRepository = localizedTextRepository;
     _cache = new CacheManager <List <LocalizedTextLabel> >(LocalizationDefaults.CACHE_KEY, (List <LocalizedTextLabel> l) => { return(LocalizationDefaults.CACHE_KEY + _langName); });
 }
Exemple #18
0
        public static StudyEventAggregatedDayItemViewModel Build(DayOfWeek day, List <StudyEventAggregatedItemViewModel> dayStudyEvents)
        {
            LanguageCode language = CultureHelper.CurrentLanguage;

            return(new StudyEventAggregatedDayItemViewModel
            {
                Day = day,
                DayStudyEvents = dayStudyEvents,
                DayString = DateTimeHelper.GetDayOfWeekStringByLanguage(day, language),
                DayStudyEventsCount = dayStudyEvents.Count()
            });
        }
        /// <summary>
        /// Replaces the title screen graphics
        /// </summary>
        /// <param name="titleMenu">The title menu - passed if we're already on the title screen</param>
        private void ReplaceTitleScreen(TitleMenu titleMenu = null)
        {
            _currentLocale = _mod.Helper.Translation.Locale;
            AddReplacement("Minigames/TitleButtons", $"Assets/Minigames/{Globals.GetTranslation("title-graphic")}");
            _mod.Helper.Content.InvalidateCache("Minigames/TitleButtons");

            if (titleMenu != null)
            {
                LanguageCode code = _mod.Helper.Translation.LocaleEnum;
                _mod.Helper.Reflection.GetMethod(titleMenu, "OnLanguageChange", true).Invoke(code);
            }
        }
Exemple #20
0
        /// <summary>Inject an asset into the cache.</summary>
        /// <typeparam name="T">The type of asset to inject.</typeparam>
        /// <param name="assetName">The asset path relative to the loader root directory, not including the <c>.xnb</c> extension.</param>
        /// <param name="value">The asset value.</param>
        /// <param name="language">The language code for which to inject the asset.</param>
        protected virtual void Inject <T>(string assetName, T value, LanguageCode language)
        {
            // track asset key
            if (value is Texture2D texture)
            {
                texture.Name = assetName;
            }

            // cache asset
            assetName             = this.AssertAndNormalizeAssetName(assetName);
            this.Cache[assetName] = value;
        }
Exemple #21
0
        public QueryExpression CreateQuery(LanguageCode languageCode)
        {
            QueryExpression query = new QueryExpression("etel_translation");

            query.Criteria.AddCondition("etel_lcid", ConditionOperator.Equal, (int)languageCode);
            query.Criteria.AddCondition("statecode", ConditionOperator.Equal, 0);
            query.ColumnSet = new ColumnSet(new string[] { "etel_lcid", "etel_formid", "etel_code", "etel_message", "modifiedon", "createdon" });
            query.Orders.Add(new OrderExpression("modifiedon", OrderType.Descending));
            query.TopCount = 5000;

            return(query);
        }
        public RsbResourceID GetItemByKey(uint ID, LanguageCode Language)
        {
            foreach (RsbResourceID entry in this)
            {
                if (entry.ID == ID && entry.Language == Language)
                {
                    return(entry);
                }
            }

            return(null);
        }
Exemple #23
0
        /*********
        ** Private methods
        *********/
        /// <summary>Get whether an asset has already been loaded.</summary>
        /// <param name="normalizedAssetName">The normalized asset name.</param>
        /// <param name="language">The language to check.</param>
        protected override bool IsNormalizedKeyLoaded(string normalizedAssetName, LanguageCode language)
        {
            string cachedKey = null;
            bool   localized =
                language != LocalizedContentManager.LanguageCode.en &&
                !this.Coordinator.IsManagedAssetKey(normalizedAssetName) &&
                this.LocalizedAssetNames.TryGetValue(normalizedAssetName, out cachedKey);

            return(localized
                ? this.Cache.ContainsKey(cachedKey)
                : this.Cache.ContainsKey(normalizedAssetName));
        }
        public int GetIndexByKey(uint ID, LanguageCode Language)
        {
            for (int i = 0; i < Count; i++)
            {
                if (this[i].ID == ID && this[i].Language == Language)
                {
                    return(i);
                }
            }

            return(-1);
        }
Exemple #25
0
    public static void CycleLanguage()
    {
        int index = Array.IndexOf(Languages, Language);

        ++index;
        if (index == Languages.Length)
        {
            index = 0;
        }
        Localizer.LanguageCode = LanguageCodes[index];
        StoredLanguage         = Localizer.LanguageCode;
    }
Exemple #26
0
        internal static string LangFile(string file)
        {
            var temp = Path.GetFileNameWithoutExtension(file);
            var lang = temp.Substring(temp.Length - 3, 3);

            if (LanguageCode.TryGetValue(lang, out string code))
            {
                return(lang);
            }

            return("und");
        }
Exemple #27
0
        public static string StringValue(this LanguageCode lc)
        {
            switch (lc)
            {
            case LanguageCode.Facet:
                return("00");

                break;

            default:
                return(lc.ToString().ToLower());
            }
        }
 public Document( String title, String summary, String contentUrl, LanguageCode language )
 {
     setField( TITLE, title );
     setField( SUMMARY, summary );
     if ( !String.IsNullOrWhiteSpace( contentUrl ) )
     {
         setField( CONTENT_URL, contentUrl );
     }
     if ( language != null )
     {
         setField( LANGUAGE, language );
     }
 }
Exemple #29
0
        public ProgramsService(
            ProgramRepository programRepository,
            StudyYearRepository studyYearRepository,
            LocaleInfo locale)
        {
            this.programRepository = programRepository ??
                                     throw new ArgumentNullException(nameof(programRepository));

            this.studyYearRepository = studyYearRepository ??
                                       throw new ArgumentNullException(nameof(studyYearRepository));

            language = locale.Language;
        }
Exemple #30
0
        public async Task <ActionResult> Create([Bind(Include = "Id,Code,LngId")] LanguageCode languagecode)
        {
            if (ModelState.IsValid)
            {
                languagecode.Id = Guid.NewGuid();
                db.LanguageCode.Add(languagecode);
                await db.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }

            return(View(languagecode));
        }
Exemple #31
0
 public CaptionAsset(JToken node) : base(node)
 {
     if (node["captionParamsId"] != null)
     {
         this._CaptionParamsId = ParseInt(node["captionParamsId"].Value <string>());
     }
     if (node["language"] != null)
     {
         this._Language = (Language)StringEnum.Parse(typeof(Language), node["language"].Value <string>());
     }
     if (node["languageCode"] != null)
     {
         this._LanguageCode = (LanguageCode)StringEnum.Parse(typeof(LanguageCode), node["languageCode"].Value <string>());
     }
     if (node["isDefault"] != null)
     {
         this._IsDefault = (NullableBoolean)ParseEnum(typeof(NullableBoolean), node["isDefault"].Value <string>());
     }
     if (node["label"] != null)
     {
         this._Label = node["label"].Value <string>();
     }
     if (node["format"] != null)
     {
         this._Format = (CaptionType)StringEnum.Parse(typeof(CaptionType), node["format"].Value <string>());
     }
     if (node["source"] != null)
     {
         this._Source = (CaptionSource)StringEnum.Parse(typeof(CaptionSource), node["source"].Value <string>());
     }
     if (node["status"] != null)
     {
         this._Status = (CaptionAssetStatus)ParseEnum(typeof(CaptionAssetStatus), node["status"].Value <string>());
     }
     if (node["parentId"] != null)
     {
         this._ParentId = node["parentId"].Value <string>();
     }
     if (node["accuracy"] != null)
     {
         this._Accuracy = ParseInt(node["accuracy"].Value <string>());
     }
     if (node["displayOnPlayer"] != null)
     {
         this._DisplayOnPlayer = ParseBool(node["displayOnPlayer"].Value <string>());
     }
     if (node["associatedTranscriptIds"] != null)
     {
         this._AssociatedTranscriptIds = node["associatedTranscriptIds"].Value <string>();
     }
 }
    private IEnumerator FetchAndReadLanguageJson()
    {
        string        languagesFilePath = Application.streamingAssetsPath + "/LanguageFiles";
        DirectoryInfo directoryInfo     = new DirectoryInfo(languagesFilePath);

        FileInfo[] allFiles = directoryInfo.GetFiles("*.json");

        LanguagesTable = new Hashtable();

        foreach (var item in allFiles)
        {
            using (UnityWebRequest languageFileReader = UnityWebRequest.Get(item.FullName))
            {
                yield return(languageFileReader.SendWebRequest());

                if (languageFileReader.isNetworkError || languageFileReader.isHttpError)
                {
                    Debug.LogWarning("Couldn't found JSON file for: " + item.FullName);
                }
                else
                {
                    JObject languageJson = JObject.Parse(languageFileReader.downloadHandler.text);

                    string lang = languageJson["Language"].ToString();

                    LanguageCode thisLangCode = ReturnLanguageCodeFromString(lang);
                    LanguagesTable[thisLangCode] = new Hashtable();

                    Hashtable subs = languageJson["Subtitles"].ToObject <Hashtable>();

                    foreach (DictionaryEntry entry in subs)
                    {
                        if (!(LanguagesTable[thisLangCode] as Hashtable).ContainsKey(entry.Key))
                        {
                            (LanguagesTable[thisLangCode] as Hashtable).Add(entry.Key, entry.Value);
                        }
                    }


                    DebugConsole.instance.Languages.text += thisLangCode.ToString() + "\n";
                }
            }
        }


#if UNITY_STANDALONE
        Debug.Log("Translations loaded");
#endif

        LANGUAGESREADY = true;
    }
Exemple #33
0
        /// <summary>Load an asset that has been processed by the content pipeline.</summary>
        /// <typeparam name="T">The type of asset to load.</typeparam>
        /// <param name="assetName">The asset path relative to the loader root directory, not including the <c>.xnb</c> extension.</param>
        /// <param name="language">The language code for which to load content.</param>
        public override T Load <T>(string assetName, LanguageCode language)
        {
            // normalise asset name
            assetName = this.AssertAndNormaliseAssetName(assetName);
            if (this.TryParseExplicitLanguageAssetKey(assetName, out string newAssetName, out LanguageCode newLanguage))
            {
                return(this.Load <T>(newAssetName, newLanguage));
            }

            // get from cache
            if (this.IsLoaded(assetName))
            {
                return(base.Load <T>(assetName, language));
            }

            // get managed asset
            if (this.Coordinator.TryParseManagedAssetKey(assetName, out string contentManagerID, out string relativePath))
            {
                T managedAsset = this.Coordinator.LoadAndCloneManagedAsset <T>(assetName, contentManagerID, relativePath, language);
                this.Inject(assetName, managedAsset);
                return(managedAsset);
            }

            // load asset
            T data;

            if (this.AssetsBeingLoaded.Contains(assetName))
            {
                this.Monitor.Log($"Broke loop while loading asset '{assetName}'.", LogLevel.Warn);
                this.Monitor.Log($"Bypassing mod loaders for this asset. Stack trace:\n{Environment.StackTrace}", LogLevel.Trace);
                data = base.Load <T>(assetName, language);
            }
            else
            {
                data = this.AssetsBeingLoaded.Track(assetName, () =>
                {
                    string locale    = this.GetLocale(language);
                    IAssetInfo info  = new AssetInfo(locale, assetName, typeof(T), this.AssertAndNormaliseAssetName);
                    IAssetData asset =
                        this.ApplyLoader <T>(info)
                        ?? new AssetDataForObject(info, base.Load <T>(assetName, language), this.AssertAndNormaliseAssetName);
                    asset = this.ApplyEditors <T>(info, asset);
                    return((T)asset.Data);
                });
            }

            // update cache & return data
            this.Inject(assetName, data);
            return(data);
        }
Exemple #34
0
    public Encounter(ApplicationID _location,
	                 string _level,
	                 int _languageArea,
	                 int _difficulty,
	                 string _details,
	                 LanguageCode _lc)
    {
        location = _location;
        level = _level;
        languageArea = _languageArea;
        difficulty = _difficulty;
        details = _details;
        lc = _lc;
    }
Exemple #35
0
        /// <inheritdoc/>
        public string ToDelimitedString()
        {
            CultureInfo culture = CultureInfo.CurrentCulture;

            return(string.Format(
                       culture,
                       StringHelper.StringFormatSequence(0, 5, Configuration.FieldSeparator),
                       Id,
                       SetIdLan.HasValue ? SetIdLan.Value.ToString(culture) : null,
                       LanguageCode?.ToDelimitedString(),
                       LanguageAbilityCode != null ? string.Join(Configuration.FieldRepeatSeparator, LanguageAbilityCode.Select(x => x.ToDelimitedString())) : null,
                       LanguageProficiencyCode?.ToDelimitedString()
                       ).TrimEnd(Configuration.FieldSeparator.ToCharArray()));
        }
    void LoadSettings()
    {
        if (loadedSettings) return;


        loadedSettings = true;
        gDocsURL = EditorPrefs.GetString(PlayerSettings.productName + "gDocs");
        TextAsset ta = (TextAsset)Resources.Load("Languages/settings", typeof(TextAsset));
        if (ta != null)
        {
            string data = ta.text;
            string[] lines = data.Split('\n');
            if (lines.Length >= 2)
            {
                useSystemLang = (lines[0] == "1");
                langCode = LocalizationSettings.GetLanguageEnum(lines[1]);
            }
        }
    }
 private void cluster( LanguageCode language )
 {
     PreprocessingContext context = preprocessingPipeline.preprocess( documents, query, language );
     clusters = new List<Cluster>();
     if ( context.hasLabels() )
     {
         VectorSpaceModelContext vsmContext = new VectorSpaceModelContext( context );
         ReducedVectorSpaceModelContext reducedVsmContext = new ReducedVectorSpaceModelContext( vsmContext );
         LingoProcessingContext lingoContext = new LingoProcessingContext( reducedVsmContext );
         matrixBuilder.buildTermDocumentMatrix( vsmContext );
         matrixBuilder.buildTermPhraseMatrix( vsmContext );
         matrixReducer.reduce( reducedVsmContext, computeClusterCount( desiredClusterCountBase, documents.Count ) );
         clusterBuilder.buildLabels( lingoContext, matrixBuilder.termWeighting );
         clusterBuilder.assignDocuments( lingoContext );
         clusterBuilder.merge( lingoContext );
         int[] clusterLabelIndex = lingoContext.clusterLabelFeatureIndex;
         BitSet[] clusterDocuments = lingoContext.clusterDocuments;
         double[] clusterLabelScore = lingoContext.clusterLabelScore;
         for ( int i = 0; i < clusterLabelIndex.length; i++ )
         {
             Cluster cluster = new Cluster();
             int labelFeature = clusterLabelIndex[i];
             if ( labelFeature < 0 )
             {
                 // Cluster removed during merging
                 continue;
             }
             cluster.addPhrases( labelFormatter.format( context, labelFeature ) );
             cluster.setAttribute( Cluster.SCORE, clusterLabelScore[i] );
             BitSet bs = clusterDocuments[i];
             for ( int bit = bs.nextSetBit( 0 ); bit >= 0; bit = bs.nextSetBit( bit + 1 ) )
             {
                 cluster.addDocuments( documents.ElementAt( bit ) );
             }
             clusters.Add( cluster );
         }
         Collections.Sort( clusters, Cluster.byReversedWeightedScoreAndSizeComparator( scoreWeight ) );
     }
     Cluster.appendOtherTopics( documents, clusters );
 }
        protected static string ParseExtendedTextFrame(byte[] data, out string description, out LanguageCode language)
        {
            int place=0;

            SingleByteField encodingField=new SingleByteField();
            place+=encodingField.Parse(data, place);

            FixedLengthAsciiTextField langField=new FixedLengthAsciiTextField(3);
            place+=langField.Parse(data, place);

            TextField descriptinoField=TextField.CreateTextField(true,(EncodingScheme)encodingField.Value);
            place+=descriptinoField.Parse(data, place);

            TextField textField=TextField.CreateTextField(false,(EncodingScheme)encodingField.Value);
            place+=textField.Parse(data, place);

            if(!Enum.IsDefined(typeof(LanguageCode), langField.Text))
            {
                langField.Text="Unknown";
            }
            language=(LanguageCode)Enum.Parse(typeof(LanguageCode), langField.Text);
            description=descriptinoField.Text;
            return textField.Text;
        }
 public CommentExtendedTextFrame(string text, string description, LanguageCode language)
     : base(text,description,language)
 {
 }
        public virtual int ReadFrom(byte[] Buffer, int StartIndex = 0)
        {
            int cursor = StartIndex;

            id = BitConverter.ToUInt32(Buffer, cursor);
            cursor += TypeSizes.INT;

            // version 5 and above has additional language code
            if (RsbVersion >= RsbFile.VERSION5)
            {
                language = (LanguageCode)BitConverter.ToUInt32(Buffer, cursor);
                cursor += TypeSizes.INT;
            }

            // look for terminating 0x00 (NULL)
            ushort strlen = 0;
            while ((Buffer.Length > cursor + strlen) && Buffer[cursor + strlen] != 0x00)
                strlen++;

            // get string
            text = Encoding.Default.GetString(Buffer, cursor, strlen);
            cursor += strlen + TypeSizes.BYTE;

            return cursor - StartIndex;
        }       
 public Document( String title, String summary, String contentUrl, LanguageCode language, String id )
     : this(title, summary, contentUrl, language)
 {
     this.id = id;
 }
    public static LocalisationSet loadLocalFromJsonFile(LanguageCode para_langID)
    {
        LocalisationSet retSet = null;

        string path = "Localisation_Files/"+System.Enum.GetName(typeof(LanguageCode),para_langID)+"/";

        string localFileName = "Local_EN";
        switch(para_langID)
        {
            case LanguageCode.EN: localFileName = "Local_EN"; break;
            case LanguageCode.GR: localFileName = "Local_GR"; break;
            default: localFileName = "Local_EN"; break;
        }
        path += localFileName;

        TextAsset ta = (TextAsset) Resources.Load(path,typeof(TextAsset));
        //string[] lines = ta.text.Split(new string[] { "\r\n" },System.StringSplitOptions.None);
        string jsonStr = ta.text;
        retSet = JsonHelper.deserialiseObject<LocalisationSet>(jsonStr);
        return retSet;
    }
 public Document( String title, String summary, LanguageCode language )
     : this(title, summary, null, language)
 {
 }
		public LanguageChangedMessage(object sender, LanguageCode language)
			: base(sender)
		{
			Language = language;
		}
Exemple #45
0
 public Language(LanguageCode language, bool useLockingShift, bool useSingleShift)
 {
     this.lang = language;
     this.useSingleShift = useSingleShift;
     this.useLockingShift = useLockingShift;
 }
 public FakeHostedPayment SetPayPageLanguageCode(LanguageCode languageCode)
 {
     LanguageCode = languageCode.ToString().ToLower();
     return this;
 }
 public RsbResourceID(uint ID, string Text, uint RsbVersion, LanguageCode Language = LanguageCode.English)
 {
     id = ID;
     text = Text;
     this.RsbVersion = RsbVersion;
     language = Language;
 }
Exemple #48
0
    public static bool loadSaveFromPlayerDownload(string para_downloadedGameState,LanguageCode language, LiteracyProfile profile)
    {
        bool successFlag = false;

        LocalisationMang.init(language);
        string gameSaveStr = para_downloadedGameState;

        try
        {
            ILearnRWSaveFilePackage savePackage = ObjectSerializerHelper.deserialiseObjFromString<ILearnRWSaveFilePackage>(gameSaveStr);
            SaveVersioningInfo saveVersionInfo =  savePackage.getGameVersionInfo();

            GameObject poRef = PersistentObjMang.getInstance();
            DatastoreScript ds = poRef.GetComponent<DatastoreScript>();

            GhostbookManagerLight gbMang;

            if((saveVersionInfo==null)||(saveVersionInfo.getYearValue()==2014)){

                ILearnRWSaveA castSave = (ILearnRWSaveA) savePackage;

                PlayerAvatarSettings tmpPASettings = castSave.getPlayerAvatarSettings();
                if(tmpPASettings == null)
                {

                    tmpPASettings = new PlayerAvatarSettings();
                    tmpPASettings.initWithDefaultState();
                }

                ds.insertData("PlayerAvatarSettings",tmpPASettings);

                PlayerGhostbookSatchel oldSatchel = castSave.getPlayerGBSatchelState();
                gbMang = new GhostbookManagerLight(oldSatchel);

            }else{
                ILearnRWSaveB castSave = (ILearnRWSaveB) savePackage;

                PlayerAvatarSettings tmpPASettings = castSave.getPlayerAvatarSettings();
                if(tmpPASettings == null)
                {

                    tmpPASettings = new PlayerAvatarSettings();
                    tmpPASettings.initWithDefaultState();
                }

                ds.insertData("PlayerAvatarSettings",tmpPASettings);

                LightSatchel satchel = castSave.getPlayerGBSatchelState();
                gbMang = new GhostbookManagerLight(satchel);

            }

            List<int[]> updates = gbMang.syncWithProfile(profile);

            foreach(int[] up in updates){
                Debug.Log("Sync: "+up[0]+" "+up[1]+" "+up[2]);
            }

            ds.insertData("IsUsingSaveFile",true);

            ds.insertData("GBMang",gbMang);

            successFlag = true;
            Debug.Log("SaveManager: Success in LOADING player file.");
        }
        catch(System.Exception ex)
        {

            Debug.Log(ex.ToString());
            Debug.Log(ex.Message);
            GameObject poRef = PersistentObjMang.getInstance();
            DatastoreScript ds = poRef.GetComponent<DatastoreScript>();
            ds.removeData("IsUsingSaveFile");
            ds.removeData("PlayerAvatarSettings");
            ds.removeData("WorldViewState");
            ds.insertData("FirstTime",true);

            Debug.LogError("SaveManager: Failed to LOAD player file.");
            successFlag = false;
        }

        return successFlag;
    }
Exemple #49
0
        /// <summary>
        /// see <see cref="SwfDotNet.IO.Tags.BaseTag">base class</see>
        /// </summary>
        public override void ReadData(byte version, BufferedBinaryReader binaryReader)
        {
            RecordHeader rh = new RecordHeader();
            rh.ReadData(binaryReader);

            fontId = binaryReader.ReadUInt16();

            bool fontFlagsHasLayout = binaryReader.ReadBoolean();
            fontFlagsShiftJIS = binaryReader.ReadBoolean();
            fontFlagsSmallText = binaryReader.ReadBoolean();
            fontFlagsANSI = binaryReader.ReadBoolean();
            bool fontFlagsWideOffsets = binaryReader.ReadBoolean();
            bool fontFlagsWideCodes = binaryReader.ReadBoolean();
            fontFlagsItalic = binaryReader.ReadBoolean();
            fontFlagsBold = binaryReader.ReadBoolean();
            languageCode = (LanguageCode)binaryReader.ReadByte();
            byte fontNameLength = binaryReader.ReadByte();

            fontName = binaryReader.ReadString(fontNameLength);

            ushort numGlyphs = binaryReader.ReadUInt16();

            if (numGlyphs > 0)
            {
                uint[] offsetTable = new uint[numGlyphs];
                for (int i = 0; i < numGlyphs; i++)
                {
                    if (fontFlagsWideOffsets)
                        offsetTable[i] = binaryReader.ReadUInt32();
                    else
                        offsetTable[i] = (uint)binaryReader.ReadUInt16();
                }
            }
            uint codeTableOffset = 0;
            if (fontFlagsWideOffsets)
                codeTableOffset = binaryReader.ReadUInt32();
            else
                codeTableOffset = (uint)binaryReader.ReadUInt16();

            if (numGlyphs > 0)
            {
                this.glyphShapesTable.IsWideCodes = fontFlagsWideCodes;
                this.glyphShapesTable.ReadData(binaryReader, numGlyphs);
            }

            if (fontFlagsHasLayout)
            {
                fontAscent = binaryReader.ReadInt16();
                fontDescent = binaryReader.ReadInt16();
                fontLeading = binaryReader.ReadInt16();

                if (numGlyphs > 0)
                {
                    fontAdvanceTable.ReadData(binaryReader, numGlyphs);
                    fontBoundsTable.ReadData(binaryReader, numGlyphs);
                    fontKerningTable.ReadData(binaryReader, fontFlagsWideCodes);
                }
            }
        }
 public void Clear(bool RaiseChangedEvent)
 {
     if (RaiseChangedEvent)
     {
         ID = 0;
         Text = String.Empty;
         RsbVersion = RsbFile.VERSION5;
         Language = LanguageCode.English;
     }
     else
     {
         id = 0;
         text = String.Empty;
         RsbVersion = RsbFile.VERSION5;
         language = LanguageCode.English;
     }
 }
 public DifficultiesDescription( LanguageArea[] p, Difficulty[][] d, LanguageCode l)
 {
     problemsIndex=p;problems=d;language=l.ToString();
 }
Exemple #52
0
 public Language(LanguageCode language)
 {
     this.lang = language;
 }
 public PaymentMethodPayment SetPayPageLanguageCode(LanguageCode languageCode)
 {
     LanguageCode = languageCode.ToString().ToLower();
     return this;
 }
        private static CodeTypeReference GetPrivateImplementationGenericType(LanguageCode language, string typeName, params string[] arguments)
        {
            if (typeName == null) throw new ArgumentNullException("typeName");
            if (arguments == null) throw new ArgumentNullException("arguments");
            if (arguments.Length == 0) throw new ArgumentException(null, "arguments");

            int indexOf = typeName.IndexOf('`');
            if (indexOf < 0)
            {
                indexOf = typeName.Length;
            }

            if (language == LanguageCode.CSharp)
            {
                string str = typeName.Substring(0, indexOf) + "<";
                for (int index = 0; index < arguments.Length; ++index)
                {
                    if (index > 0)
                        str += ",";

                    str += CodeDomUtilities.CreateCSharpEscapedIdentifier(arguments[index]);
                }
                return new CodeTypeReference(str + ">");
            }

            if (language == LanguageCode.VisualBasic)
            {
                string str1 = typeName.Substring(0, indexOf) + "(Of ";
                for (int index = 0; index < arguments.Length; ++index)
                {
                    if (index > 0)
                        str1 += ",";
                    str1 += CodeDomUtilities.CreateVisualBasicEscapedIdentifier(arguments[index]);
                }
                return new CodeTypeReference((str1 + ")").Replace("(Of ", "_").Replace(")", "_"));
            }

            return CodeDomUtilities.GetGenericType(typeName, arguments);
        }
        /// <summary>
        /// Get the country where a language comes from.
        /// </summary>
        /// <remarks>
        /// For example for Englisch (<see cref="LanguageCode.En"/>) this is United Kingdom (<see cref="CountryCode.Gb"/>).
        /// In ambiguous cases, there was done some research, but it still may be incorrect.
        /// </remarks>
        /// <param name="languageCode">The <see cref="LanguageCode"/> to get the <see cref="CountryInfo"/> of the country where the language comes from.</param>
        /// <returns>The country where a language comes from or null when this is not handled here.</returns>
        private static CountryInfo GetCountryForLanguage(LanguageCode languageCode)
        {
            switch (languageCode)
            {
                // Arabic -> Saudi Arabia
                case LanguageCode.Ar:
                    return CountryInfo.GetCountry(CountryCode.Sa);

                // Bengali -> Bangladesh
                case LanguageCode.Bg:
                    return CountryInfo.GetCountry(CountryCode.Bd);

                // English -> United Kingdom
                case LanguageCode.En:
                    return CountryInfo.GetCountry(CountryCode.Gb);

                // Malay -> Malaysia
                case LanguageCode.Ms:
                    return CountryInfo.GetCountry(CountryCode.My);

                // Serbian -> Serbia
                case LanguageCode.Sr:
                    return CountryInfo.GetCountry(CountryCode.Rs);

                // Chinese -> China
                case LanguageCode.Zh:
                    return CountryInfo.GetCountry(CountryCode.Cn);
            }

            return null;
        }
    // Initialisation. Load the generic file as default.
    public static void init(LanguageCode para_langCode)
    {
        langCode = para_langCode;
        loadedGenericFile = null;
        loadedGenericFile = loadLocalFromJsonFile(para_langCode);

        translations = new Dictionary<string,string>();

        TextAsset ta = Resources.Load<TextAsset>("Localisation_Files/EN2GR");
        if(ta!=null){
            string[] tmpSS = ta.text.Split('\n');

            foreach(string pair in tmpSS)
                if(para_langCode==LanguageCode.GR)
                    translations.Add (pair.Split(',')[0], pair.Split(',')[1]);
            else
                translations.Add (pair.Split(',')[0], pair.Split(',')[0]);

        }
    }
Exemple #57
0
        private void SaveConfig(IPAddress ip, int port, LanguageCode language, string login)
        {
            using (XmlWriter writer = XmlWriter.Create("config.xml"))
            {
                writer.WriteStartDocument();
                writer.WriteWhitespace("\n");
                writer.WriteStartElement("Document");
                writer.WriteWhitespace("\n\t");
                writer.WriteComment("This file is automatically generated by Client application. Changes to this file may cause its incorrect behavior.");
                writer.WriteWhitespace("\n\t");
                writer.WriteStartElement("Header");
                writer.WriteAttributeString("Autor", "InfinityGames2012");
                writer.WriteAttributeString("Version", "1.0");
                writer.WriteEndElement();
                writer.WriteWhitespace("\n\t");
                writer.WriteStartElement("Data");

                createElement(writer, "\n\t\t", "Address", ip.ToString());
                createElement(writer, "\n\t\t", "Port", port.ToString());
                createElement(writer, "\n\t\t", "LanguageCode", ((short)language).ToString());
                createElement(writer, "\n\t\t", "Login", login);

                writer.WriteWhitespace("\n\t");
                writer.WriteEndElement();
                writer.WriteWhitespace("\n");
                writer.WriteEndElement();
            }
            Console.WriteLine("Configuration file saved successfully.");
        }
Exemple #58
0
    public static bool SwitchLanguage(LanguageCode code)
    {
        if (availableLanguages.Contains(code + ""))
        {
            DoSwitch(code);
            return true;
        }
        else
        {
            Debug.LogError("Could not switch from language " + currentLanguage + " to " + code);
            if (currentLanguage == LanguageCode.N)
            {
                if (availableLanguages.Count > 0)
                {
                    DoSwitch(LocalizationSettings.GetLanguageEnum(availableLanguages[0]));
                    Debug.LogError("Switched to " + currentLanguage + " instead");
                }
                else
                {
                    Debug.LogError("Please verify that you have the file: Resources/Languages/" + code + "");
                    Debug.Break();
                }
            }

            return false;
        }

    }
Exemple #59
0
    static void DoSwitch(LanguageCode newLang)
    {
		Debug.Log("Switching language: " + newLang);
        PlayerPrefs.GetString("M2H_lastLanguage", newLang + "");

        currentLanguage = newLang;
        currentEntrySheets = new Dictionary<string, Hashtable>();
		defaultEntrySheets = new Dictionary<string, Hashtable>();

        XMLParser xmlparser = new XMLParser();
		
		//load language from server, if possible
        foreach (string sheetTitle in settings.sheetTitles)
        {
            currentEntrySheets[sheetTitle] = new Hashtable();

            Hashtable main = (Hashtable)xmlparser.Parse(GetLanguageFileContents(sheetTitle));
            ArrayList entries = (ArrayList)(((ArrayList)main["entries"])[0] as Hashtable)["entry"];
            foreach (Hashtable entry in entries)
            {
                string tag = (string)entry["@name"];
                string data = (entry["_text"] + "").Trim();
                data = data.UnescapeXML();
                (currentEntrySheets[sheetTitle])[tag] = data;
            }
        }
		
		//load default language file
		foreach (string sheetTitle in settings.sheetTitles)
        {
			if (HasLanguageFileLocally(currentLanguage + "", sheetTitle)) {
	            defaultEntrySheets[sheetTitle] = new Hashtable();
	
	            Hashtable main = (Hashtable)xmlparser.Parse(((TextAsset)Resources.Load("Languages/" + currentLanguage + "_" + sheetTitle, typeof(TextAsset))).text);
	            ArrayList entries = (ArrayList)(((ArrayList)main["entries"])[0] as Hashtable)["entry"];
	            foreach (Hashtable entry in entries)
	            {
	                string tag = (string)entry["@name"];
	                string data = (entry["_text"] + "").Trim();
	                data = data.UnescapeXML();
	                (defaultEntrySheets[sheetTitle])[tag] = data;
	            }
			}
			else {
				defaultEntrySheets = currentEntrySheets;
			}
        }
		
        //Update all localized assets
        LocalizedAsset[] assets = (LocalizedAsset[])GameObject.FindObjectsOfType(typeof(LocalizedAsset));
        foreach (LocalizedAsset asset in assets)
        {
            asset.LocalizeAsset();
        }

        SendMonoMessage("ChangedLanguage", currentLanguage);
    }
 public PackagedUserProfile(LiteracyProfile u, UserPreferences p, LanguageCode l)
 {
     userProblems = u; preferences = p; language = l.ToString();
 }