duration-translation
v1.0.2
Published
The Time Unit Translator is a lightweight npm package for translating time units with ease. Convert seconds, minutes, hours, days, and months into localized forms in any language. Customize translations and formatting effortlessly. Open source and user-fr
Downloads
5
Readme
duration-translation
The duration-translation
package is a lightweight npm module that allows you to translate time durations into different languages. It provides a simple and flexible way to convert seconds, minutes, hours, days, months and years into their corresponding localized forms.
Installation
Install the package using npm:
npm install duration-translation Usage Import the package into your project:
const duration = require('duration-translation');
//Translate a duration to a specific language:
let translatedDuration = duration('1m', 'hu');
console.log(translatedDuration); // Output: '1 perc'
You can use the duration function to translate time durations into various languages. The first argument is the duration string (e.g., '1m' for 1 minute), and the second argument is the language code (e.g., 'hu' for Hungarian).
Contributing
Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
License
This package is open source and available under the MIT License.