Auto create terms from a script with strings
			
	
						9 years 1 month ago				#1741
		by rak2410
	
	
		
			
	
			
			 		
													
	
				Auto create terms from a script with strings was created by rak2410			
			
				Hi,
I just purchased and installed your plugin.
Still getting a hang of it.
But what I want to do is - Auto create terms from a script file consisting of const static strings.
I have created these strings and I refer them from other scripts to access the string value.
So is this possible? Because it would save me a lot of time.
Thanks,
Rakshith,
RedForce Games
					I just purchased and installed your plugin.
Still getting a hang of it.
But what I want to do is - Auto create terms from a script file consisting of const static strings.
I have created these strings and I refer them from other scripts to access the string value.
So is this possible? Because it would save me a lot of time.
Thanks,
Rakshith,
RedForce Games
Please Log in or Create an account to join the conversation.
			
	
						9 years 1 month ago		 -  9 years 1 month ago		#1747
		by Frank
	
	
		
			
					
Are you Give I2L 
	5 stars!
  Give I2L 
	5 stars!
Are you Please lets us know how to improve it!
  Please lets us know how to improve it!
					
	
	
			 		
													
	
				Replied by Frank on topic Auto create terms from a script with strings			
			
				Hi,
Sorry, I thought I already answered you, but It seems that I totally forgot to do that. I'm really sorry about that.
If you already have a way to get the strings you need with reflection or by parsing the cs files, its easy to add the terms dynamically, just place the following code in one editor script:
Hope that helps,
Frank
							Sorry, I thought I already answered you, but It seems that I totally forgot to do that. I'm really sorry about that.
If you already have a way to get the strings you need with reflection or by parsing the cs files, its easy to add the terms dynamically, just place the following code in one editor script:
Dictionary<string,string> translatedTerms = ..... get your terms with reflection or by parsing the cs file ...
var I2Languages = I2.Loc.LocalizationManager.Sources[0];
foreach (var kvp in translatedTerms)
{
     var term = kvp.Key;
     var translation = kvp.Value;
     var termData = I2Languages.AddTerm(term, I2.Loc.LanguageSource.eTermType.Text, false);
     termData.Languages[0] = translation;
}
UnityEditor.EditorUtility.SetDirty(I2Languages);
UnityEditor.AssetDatabase.SaveAssets();Hope that helps,
Frank
Are you
Are you
To get the betas as soon as they are ready, 
	check this out
				
		Last edit: 9 years 1 month ago  by Frank.			
			Please Log in or Create an account to join the conversation.
			
	
						9 years 1 month ago				#1748
		by rak2410
	
	
		
			
	
			
			 		
													
	
				Replied by rak2410 on topic Auto create terms from a script with strings			
			
				No problem 
I think this is exactly what I was looking for.
Ill get back to you for more.
Thanks!
Rakshith
					I think this is exactly what I was looking for.
Ill get back to you for more.
Thanks!
Rakshith
Please Log in or Create an account to join the conversation.
		Time to create page: 0.200 seconds	
