What I built
I built a GitHub Action called "Lime" that enhances the pull request workflow by automatically translating the text in the readme file to Swahili.
Category Submission:
Wacky Wildcards
App Link
Screenshots
Description
The Lime GitHub Action is designed to streamline the localization process for projects by providing automated translation capabilities for readme files. By leveraging this action, developers can ensure that their project's documentation is accessible to a broader audience, particularly those who prefer Swahili as their primary language.
The Line action integrates seamlessly into the pull request workflow. When a new pull request is created or an existing one is updated, the action automatically detects the readme file and translates its contents to Swahili using a pre-configured google translation api service. This allows contributors and reviewers to understand the project's documentation in Swahili, facilitating collaboration and inclusion.
Link to Source Code
Permissive License
The Line GitHub Action is released under the permissive MIT License. This license allows developers to freely use, modify, and distribute the action while providing appropriate attribution.
Background
I decided to build the Lime GitHub Action to address the challenge of language localization in open-source projects. It is essential to make software accessible to users from different regions and cultural backgrounds. By providing automated translation capabilities, developers can ensure that their projects are more inclusive and reach a wider audience. Additionally for news related articles and project that need to be done in Swahili.
The inspiration for this project came from my own experiences as a developer and contributor to open-source projects. I often noticed the lack of localized documentation, which can be a significant barrier for non-English speakers. I wanted to create a solution that simplifies the localization process and encourages project maintainers to provide translations for their documentation effortlessly.
How I built it
To build the Lime GitHub Action, I utilized GitHub Actions, a powerful workflow automation tool provided by GitHub. GitHub Actions allows developers to create custom workflows that automatically trigger specific actions in response to events, such as pull requests.
The core functionality of the Lime GitHub Action is implemented in a JavaScript function. This function leverages the Google Translation API to perform the translation of the readme file's contents. The JavaScript function is called from the workflows YAML file, which defines the steps and triggers for the action.
Here's a simplified part of the javascript function
translateText(readmeContent,'sw' )
.then((translation) => {
console.log(`Translation: ${translation}`);
// Append the translated text to the end of the README file
const translatedReadmeContent = `${readmeContent}\n\nTranslated Text:\n\n${translation}`;
fs.writeFileSync(readmePath, translatedReadmeContent);
})
.catch((error) => console.error(`Error: ${error}`));
Top comments (0)