Raised This Month: $51 Target: $400
 12% 

I created a function to check if a translation exists


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 06-24-2017 , 01:30   I created a function to check if a translation exists
Reply With Quote #1

Old Code

See new code here.

Last edited by joao7yt; 06-25-2017 at 02:56.
joao7yt is offline
Benoist3012
Veteran Member
Join Date: Mar 2014
Location: CWave::ForceFinish()
Old 06-24-2017 , 07:55   Re: I created a function to check if a translation exists
Reply With Quote #2

Wrong section buddy, you have to post it there:
https://forums.alliedmods.net/forumdisplay.php?f=112
__________________
Benoist3012 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 06-24-2017 , 08:39   Re: I created a function to check if a translation exists
Reply With Quote #3

Be aware that translation files are SMC format, not KeyValues. There are subtle differences and can exist valid translation files that will fail with FileToKeyValues.

If you want a more robust solution, use the SMC parser.
psychonic is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 06-24-2017 , 10:47   Re: I created a function to check if a translation exists
Reply With Quote #4

Quote:
Originally Posted by Benoist3012 View Post
Wrong section buddy, you have to post it there:
https://forums.alliedmods.net/forumdisplay.php?f=112
Can someone move or delete this?
joao7yt is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 06-24-2017 , 10:49   Re: I created a function to check if a translation exists
Reply With Quote #5

Quote:
Originally Posted by psychonic View Post
Be aware that translation files are SMC format, not KeyValues. There are subtle differences and can exist valid translation files that will fail with FileToKeyValues.

If you want a more robust solution, use the SMC parser.
Ok, didn't know about it, can you give an example about a valid translation that won't work with KeyValues? I will give a try to SMC Parser and update the code.
joao7yt is offline
psychonic

BAFFLED
Join Date: May 2008
Old 06-24-2017 , 11:14   Re: I created a function to check if a translation exists
Reply With Quote #6

Quote:
Originally Posted by joao7yt View Post
Ok, didn't know about it, can you give an example about a valid translation that won't work with KeyValues? I will give a try to SMC Parser and update the code.
Code:
/*
 * This is my translation file for Plugin X
 */
"Phrases"
{
	"My phrase"
	{
		"en"			"Hi"
	}
}
psychonic is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 06-24-2017 , 11:23   Re: I created a function to check if a translation exists
Reply With Quote #7

Quote:
Originally Posted by psychonic View Post
Code:
/*
 * This is my translation file for Plugin X
 */
"Phrases"
{
	"My phrase"
	{
		"en"			"Hi"
	}
}
Oh, ok, KeyValues doesn't support comments. Thank you. I will update the code soon.
joao7yt is offline
psychonic

BAFFLED
Join Date: May 2008
Old 06-24-2017 , 11:34   Re: I created a function to check if a translation exists
Reply With Quote #8

Quote:
Originally Posted by joao7yt View Post
Oh, ok, KeyValues doesn't support comments. Thank you. I will update the code soon.
It supports single line comments, not multi-line.
psychonic is offline
joao7yt
Senior Member
Join Date: Nov 2014
Location: Brazil
Old 06-25-2017 , 02:49   Re: I created a function to check if a translation exists
Reply With Quote #9

Done, posted here.

Last edited by joao7yt; 06-25-2017 at 02:57.
joao7yt is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 00:21.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode