I think a useful feature would be if the translate function was updated so that if source.lang is not provided for the Microsoft translation it has the API detect the language. This can be easily done in the Microsoft azure API by omitting the source language parameter.
I think this could be accomplished by updating the validateInput function so that the code to check for a valid language source code is updated to be:
if (!(is.null(source.lang))) { if (!(source.lang %in% unname(unlist(languages["Microsoft"])))) { msg <- paste("The source.lang '", source.lang, "' is not a valid Microsoft language code. To see a list of Microsoft language codes, use getMicrosoftLanguages().", sep = "") stop(msg) } }
and the code for the microsoftTranslateToken function is updated so the code to assign the parameters is:
if (missing(source.lang)) { params = paste("text=", URLencode(x), "&from=", source.lang, sep = "") } else { params = paste("text=", URLencode(x), "&to=", target.lang, "&from=", source.lang, sep = "") }
I think a useful feature would be if the translate function was updated so that if source.lang is not provided for the Microsoft translation it has the API detect the language. This can be easily done in the Microsoft azure API by omitting the source language parameter.
I think this could be accomplished by updating the
validateInput
function so that the code to check for a valid language source code is updated to be:if (!(is.null(source.lang))) { if (!(source.lang %in% unname(unlist(languages["Microsoft"])))) { msg <- paste("The source.lang '", source.lang, "' is not a valid Microsoft language code. To see a list of Microsoft language codes, use getMicrosoftLanguages().", sep = "") stop(msg) } }
and the code for the
microsoftTranslateToken
function is updated so the code to assign the parameters is:if (missing(source.lang)) { params = paste("text=", URLencode(x), "&from=", source.lang, sep = "") } else { params = paste("text=", URLencode(x), "&to=", target.lang, "&from=", source.lang, sep = "") }