Is it possible to add termes via a scripts.
- CavernHead
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
6 years 9 months ago #2797
by CavernHead
Is it possible to add termes via a scripts. was created by CavernHead
So I would just like to know how to simply use the (+) add key function thats in the inspector of I2language.prefab but in a script
Please Log in or Create an account to join the conversation.
6 years 9 months ago #2799
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Is it possible to add termes via a scripts.
You can use the following:
Hope that helps,
Frank
var termData = LocalizationManager.Sources[0].AddTerm("My New Term");
termData.Languages[0] = "This is an Example";
termData.Languages[1] = "Esto es un ejemplo";
// after adding al the terms
LocalizationManager.Sources[0].UpdateDictionary();
Hope that helps,
Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
The following user(s) said Thank You: CavernHead
Please Log in or Create an account to join the conversation.
- CavernHead
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
6 years 9 months ago #2800
by CavernHead
Replied by CavernHead on topic Is it possible to add termes via a scripts.
okey that perfect that will spare me alote of time. thanks alot
Please Log in or Create an account to join the conversation.
- CavernHead
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
6 years 9 months ago #2802
by CavernHead
Replied by CavernHead on topic Is it possible to add termes via a scripts.
So i did what you told a manged to add the terms but when it commes to removing them all. I manage but there is an error along the way im not sure im using the right methodes this is what i do.
public static void RemoveAllTerms()
{
while(LocalizationManager.Sources[0].mTerms.Count>0)
{
LocalizationManager.Sources[0].RemoveTerm(LocalizationManager.Sources[0].mTerms[0].Term) ;
}
LocalizationManager.Sources[0].UpdateDictionary();
}
public static void RemoveAllTerms()
{
while(LocalizationManager.Sources[0].mTerms.Count>0)
{
LocalizationManager.Sources[0].RemoveTerm(LocalizationManager.Sources[0].mTerms[0].Term) ;
}
LocalizationManager.Sources[0].UpdateDictionary();
}
Please Log in or Create an account to join the conversation.
6 years 9 months ago #2803
by Frank
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
Replied by Frank on topic Is it possible to add termes via a scripts.
Can you also post whats the error you are getting. That may give me a better hint.
Also, there is an easy to way to accomplish the Remove All:
Also, there is an easy to way to accomplish the Remove All:
var source = LocalizationManager.Sources[0];
source.mTerms.Clear();
source.mDictionary.Clear();
#if UNITY_EDITOR
UnityEditor.EditorUtility.SetDirty (source);
#endif
Are you Give I2L 5 stars!
Are you Please lets us know how to improve it!
To get the betas as soon as they are ready,
check this out
The following user(s) said Thank You: CavernHead
Please Log in or Create an account to join the conversation.
- CavernHead
- Topic Author
- Offline
- New Member
Less
More
- Posts: 8
- Thank you received: 0
6 years 9 months ago - 6 years 9 months ago #2804
by CavernHead
Replied by CavernHead on topic Is it possible to add termes via a scripts.
okey I just did what you suggested but i still get the error. Also now I have another problem its that the terms arn't added in the order i added them. Basicly im using a methode to add each terme from my script. Like this I can transfere my 500 termes from my script to the spread sheet. They seem to re order them selfs alphabetlcly from what i can tell. but the order is important so it doesn't becom a messy in the spreadsheet. I added a pic with the error. Also Im sorry if im not using your scripts in the conventional way : -) .
Last edit: 6 years 9 months ago by CavernHead.
Please Log in or Create an account to join the conversation.
Time to create page: 0.170 seconds