I had this problem before. The solutin was a table.
On the API I was using at the time, keyboard input was made calling a device update method and than checking if a key is active by its code . for instance Readkey('a') would return true if a is active.
I made a wrapper for this API. Inside this class was a table that associates standard keys ( like up for walk and space for jump) with user defined keys. The class had a readkey(method) that receives a standard key and returns the status of the mapped user defined key, by calling the API method.
So, in my game code, I ever check the status of standar keys leting the translation work for the wrapper.