Finding records that don't have a translation
I am back with another question: I love SPFs!
I have a table which holds all the language strings for my website.
A string is made up of three parts: the variable name (ie lang_home) of the string, the text associated with this string (ie "Home") and the language this is in. None of these is unique.
I would like to query my DB to help me figure out which variables have not been translated. Here following are the DB scheme and some sample data:
CREATE TABLE locales (
id mediumint(9) NOT NULL AUTO_INCREMENT,
`name` varchar(100) NOT NULL,
`text` text NOT NULL,
lang varchar(5) NOT NULL,
mod_time int(10) unsigned NOT NULL,
PRIMARY KEY (id),
KEY lang (lang),
KEY `name` (`name`),
FULLTEXT KEY `text` (`text`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
In this case, I would like to query the DB for missing it-IT translations and have it return 'lang_test'.
INSERT INTO locales SET name = 'lang_home', text = 'Home', lang = 'en-US';
INSERT INTO locales SET name = 'lang_home', text = 'Casa', lang = 'it-IT';
INSERT INTO locales SET name = 'lang_test', text = 'Test', lang = 'en-US';
How could I do this?