There are many famous swords in The Hobbit. First, Bilbo's sword, Sting, is originally an Elven dagger. Second, Gandalf's sword, Glamdring, Foe-Hammer, was originally the sword of the King of Gondolin. Third, Thorin's sword, Orcrist, Goblin-Cleaver, was also from Gondolin. read more
It can be assumed that Bilbo had the Elves of Rivendell add the inscription when he named the sword. All of the swords were forged in Gondolin during the First Age and would have seen battle then, but likely no other time until they were found by Thorin and COmpany. read more