Skip to content

Commit c967de5

Browse files
authored
Merge pull request #5 from brownrw8/future
Future refactor
2 parents dbb210b + 24d3320 commit c967de5

92 files changed

Lines changed: 2962 additions & 1449 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 100 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
#### 🌺🌸🌼 Bloom Your Internationalization Workflow! 🌷🌻🌹
44

5-
#### 🎉 Now in Beta and Release Candidate (RC)!! 🎉
5+
#### 🌟 Meet Our Smarter, Faster AI Language Engine! 🌟
66

7-
(ʻŌlelo Honua can be translated to mean "World Language" or "Language Bridge" in Hawaiian.)
7+
Ready to supercharge your i18n workflow? Our newly revamped AI language engine is here to make translations smarter, faster, and more intuitive. It delivers spot-on, culturally aware translations in record time, with built-in support for async and parallel processing. Whether you're scaling up or just starting out, this engine grows with you—making multilingual app development effortless and efficient. Say hello to the future of i18n!
88

99
## Simplify Your Internationalization Workflow with ʻŌlelo Honua
1010

@@ -17,8 +17,11 @@ Why waste time on repetitive tasks when you can streamline your i18n process wit
1717
## Challenges in Multilingual App Development and How ʻŌlelo Honua Solves Them
1818

1919
### Problem
20+
2021
Imagine building an app that speaks to the world. You start with one language, but as your app grows, so does the demand for multilingual support. Manually crafting and updating translation files for every new language? It’s a grind—tedious, error-prone, and a major time sink. Sound familiar?
2122

23+
With these models, ʻŌlelo Honua ensures you have access to the best tools for your internationalization needs, whether you're working on a small project or scaling to global audiences.
24+
2225
### Solution
2326

2427
Say goodbye to the headaches of managing translation files! ʻŌlelo Honua takes the grunt work out of internationalization by automating the creation and synchronization of translation files. With support for trusted providers like Google Translate, it ensures your translations are not only accurate but also always up-to-date. Save time, eliminate errors, and focus on what truly matters—building a world-class multilingual app.
@@ -30,21 +33,10 @@ Here's a simple illustration:
3033

3134
This automation makes it easier to manage internationalization in your application, allowing you to focus on other stuff!
3235

33-
### State Diagram
36+
### Technical Deep Dive
3437

3538
For more details about my approach, vision, and methodology, refer to [About ʻŌlelo Honua](docs/ABOUT.md).
3639

37-
![State Diagram](docs/clean_state_diagram.png)
38-
39-
40-
## Introducing Critiques
41-
42-
Critiques are a way to evaluate and improve the quality of translations by identifying areas where they may lack clarity, cultural accuracy, or grammatical correctness. ʻŌlelo Honua provides an optional feature to generate AI-powered critiques for translations, helping you refine and enhance your localization efforts.
43-
44-
### Example Critique
45-
46-
An example of an AI-generated critique can be seen [here](examples/basic/critiques/critique.en.haw.md).
47-
4840
## Installation
4941

5042
To install the library, use npm or yarn:
@@ -65,24 +57,28 @@ Here's how you use the library:
6557

6658
```javascript
6759
const { OleloHonua, DeepSeekProvider } = require("olelo-honua");
68-
6960
// Create a new instance
7061
const dakine = new OleloHonua(
7162
{
72-
primeLanguage: "haw",
73-
excludeLanguage: ["ja", "en", "de"],
74-
critique: true,
75-
repair: true,
63+
provider: {
64+
platform: OleloHonua.Providers.OpenRouter,
65+
credentials: {
66+
apiKey: process.env.OPEN_ROUTER_API_KEY, // Open Router API Key from .env
67+
},
68+
modelId: OleloHonua.OpenRouterModels.DEEPSEEK.DEEPSEEK_V3_FREE, // Model ID
69+
},
70+
primeLanguage: "en", // Default language
71+
excludeLanguage: ["haw"], // Additional languages
72+
debug: true, // Enable debug
7673
},
77-
new DeepSeekProvider({ apiKey: '<your_openrouter_api_key>' }), // Highly recommend DeepSeekProvider since it's free & reliable
7874
);
7975
// Runs or re-runs i18n translations
8076
dakine.hanaHou(); // or use alias dakine.createLocaleFiles()
8177
```
8278

8379
## Configuration
8480

85-
I highly recommend setting up an OpenRouter API Key for use with various models.
81+
I highly recommend setting up an OpenRouter API Key for use with various models.
8682

8783
[How to set up OpenRouter API Key](docs/API_KEY_SETUP.md)
8884

@@ -95,56 +91,108 @@ OPENROUTER_API_KEY=<your_openrouter_api_key>
9591
Then, use a library like `dotenv` to load the key into your application:
9692

9793
```javascript
98-
require('dotenv').config();
94+
require("dotenv").config();
9995
const apiKey = process.env.OPENROUTER_API_KEY;
10096
```
10197

10298
This approach keeps your sensitive information out of your codebase and makes it easier to manage across different environments.
10399

104-
You need to provide a configuration object and a translation provider. For instance, you can use the `DeepSeekProvider` as demonstrated in the usage example. I highly recommend DeepSeek & OpenRouter as these are free and extremely stable. Happy coding!
105-
100+
You need to provide a configuration object and a translation provider. For instance, you can use the `DeepSeekProvider` as demonstrated in the usage example. I highly recommend DeepSeek & OpenRouter as these are free and extremely stable. Happy coding!
106101

107102
## Configuration Example
108103

109104
Here is an example of full configuration options:
110105

111106
```javascript
112-
const config: LocaleConfig = {
113-
primeLanguage: "en",
114-
includeLanguage: ["haw", "ar", "es", "fr"], // Specify languages to include
115-
// Alternatively, you can use excludeLanguage: ["ja"] to exclude specific languages
116-
bulkTranslate: true, // Use bulk translation for better performance (replaces useBulkProvider, which is being deprecated)
117-
critique: true, // Enable AI critique for translations
118-
saveCritique: false, // Optionally save critiques for further analysis
119-
repair: false, // Enable or disable automatic repair of translations
120-
debug: false, // Enable debug mode for detailed logs
121-
multiLanguageAgreementThreshold: 0.8, // Set threshold for multi-language agreement
122-
loopRetryOptions: {
123-
mainLoopRetries: 3, // Number of retries for the main loop
124-
critiqueLoopRetries: 2, // Number of retries for critique loop
125-
repairLoopRetries: 1, // Number of retries for repair loop
107+
const config: Config = {
108+
primeLanguage: "en", // The primary language to use
109+
provider: {
110+
platform: "OpenRouter", // Supported platforms: 'OpenRouter' | 'OpenAI' | 'GoogleTranslate' | 'Custom'
111+
credentials: {
112+
apiKey: "<your_openrouter_api_key>", // Required for OpenRouter and OpenAI
113+
},
114+
modelId: "deepseek/deepseek-chat-v3-0324:free", // Model ID for OpenRouter and OpenAI
115+
},
116+
retries: {
117+
mainLoop: 3, // Retry limit for the main loop
118+
critiqueLoop: 2, // Retry limit for critique loop
119+
repairLoop: 1, // Retry limit for repair loop
120+
},
121+
debug: false, // Enable or disable debug mode
122+
includeLanguage: ["haw", "ar", "es", "fr"], // Languages to include, or alteratively...
123+
// excludeLanguage: ["haw", "ar", "es", "fr", "amh", "tg", "uz", "km", "lo", "my", "ne", "si", "ky", "mn", "ps", "sd", "tk", "ug", "xh", "zu"],
124+
maxChunkRequests: 4, // Maximum number of chunk requests
125+
additionalConfig: {
126+
critique: true, // Enable AI critique for translations
127+
saveCritique: false, // Optionally save critiques for further analysis
128+
repair: false, // Enable or disable automatic repair of translations
129+
multiLanguageAgreementThreshold: 0.8, // Set threshold for multi-language agreement
126130
},
127131
};
128132
```
129133

130-
### Supported Models
134+
## Supported Providers
131135

132-
ʻŌlelo Honua supports a variety of translation providers, each tailored to specific use cases:
136+
Olelo Honua integrates with OpenRouter, OpenAI/ChatGPT, Google Translate, and even local LLM providers.
133137

134-
- **OpenRouterProvider**: A free and reliable option for general-purpose translation tasks, ideal for developers seeking stability without additional costs.
135-
- **DeepSeekProvider**: Highly recommended for its speed, accuracy, and cost-effectiveness, making it a great choice for production environments.
136-
- **MultiLanguageProvider**: Specializes in handling translations for multiple languages simultaneously, ensuring consistency across diverse locales.
137-
- **GemmaProvider**: Designed for high-quality translations, offering advanced features like context-aware adjustments and cultural sensitivity.
138-
- **LlamaProvider**: Optimized for large-scale translation projects, suitable for applications with extensive multilingual content.
139-
- **MistralProvider**: Provides robust and scalable translation capabilities, ideal for enterprise-level use cases and complex workflows.
140-
- **QwenProvider**: Utilizes state-of-the-art translation technology, delivering precise and modern translations for cutting-edge applications.
141-
- **GoogleTranslateProvider**: Leverages the well-known Google Translate API for dependable and widely supported translations.
142-
- **OpenAIChatGPTProvider**: Uses OpenAI's ChatGPT to generate contextual and conversational translations, perfect for dynamic or interactive content.
143-
- **ToyProvider**: A lightweight and simple provider intended for testing, prototyping, or development purposes.
138+
### Supported Models
139+
140+
ʻŌlelo Honua integrates with a variety of models to streamline your translation workflow. Below is a list of supported models categorized by provider:
141+
142+
#### OpenRouter Models
143+
144+
- **DeepSeek**
145+
- `deepseek/deepseek-chat-v3-0324:free`
146+
- `deepseek/deepseek-r1:free`
147+
- `deepseek/deepseek-chat:free`
148+
- **Google**
149+
- `google/gemini-2.5-pro-exp-03-25:free`
150+
- `google/gemma-3-1b-it:free`
151+
- `google/gemma-3-4b-it:free`
152+
- `google/gemma-3-12b-it:free`
153+
- `google/gemma-3-27b-it:free`
154+
- `google/gemini-2.0-flash-lite-preview-02-05:free`
155+
- `google/gemini-2.0-pro-exp-02-05:free`
156+
- `google/gemini-2.0-flash-thinking-exp:free`
157+
- `google/gemini-2.0-flash-thinking-exp-1219:free`
158+
- `google/gemini-2.0-flash-exp:free`
159+
- `google/learnlm-1.5-pro-experimental:free`
160+
- `google/gemma-2-9b-it:free`
161+
- **Llama2**
162+
- `sophosympatheia/rogue-rose-103b-v0.2:free`
163+
- `gryphe/mythomax-l2-13b:free`
164+
- **Llama3**
165+
- `deepseek/deepseek-r1-distill-llama-70b:free`
166+
- `meta-llama/llama-3.3-70b-instruct:free`
167+
- `nvidia/llama-3.1-nemotron-70b-instruct:free`
168+
- `meta-llama/llama-3.2-3b-instruct:free`
169+
- `meta-llama/llama-3.2-1b-instruct:free`
170+
- `meta-llama/llama-3.1-8b-instruct:free`
171+
- `meta-llama/llama-3-8b-instruct:free`
172+
- **Qwen**
173+
- `qwen/qwq-32b:free`
174+
- `deepseek/deepseek-r1-distill-qwen-32b:free`
175+
- `deepseek/deepseek-r1-distill-qwen-14b:free`
176+
- `qwen/qwq-32b-preview:free`
177+
- `qwen/qwen-2.5-coder-32b-instruct:free`
178+
- `qwen/qwen-2.5-72b-instruct:free`
179+
- `qwen/qwen-2-7b-instruct:free`
180+
- **Mistral**
181+
- `mistralai/mistral-7b-instruct:free`
182+
183+
#### OpenAI Models
184+
185+
- **OpenAI**
186+
- `openai/davinci`
187+
- `openai/curie`
188+
- `openai/babbage`
189+
- `openai/ada`
190+
- `openai/gpt-3.5-turbo`
191+
- `openai/gpt-4o`
144192

145193
> **Note**: Free models, such as OpenRouterProvider, come with a token limit. Ensure your usage stays within the allowed quota to avoid interruptions.
146194
147-
Select the provider that aligns with your application's specific needs (and performance requirements) 🌟.
195+
Select the provider/model that aligns with your application's specific needs (and performance requirements) 🌟.
148196

149197
## Caching
150198

@@ -160,86 +208,7 @@ In addition to **Hawaiian** 🌺, ʻŌlelo Honua supports a wide range of langua
160208

161209
<details>
162210
<summary>Supported Languages 🌍</summary>
163-
164-
- **Afrikaans** 🇿🇦
165-
- **Albanian** 🇦🇱
166-
- **Amharic** 🇪🇹
167-
- **Arabic** 🇸🇦
168-
- **Armenian** 🇦🇲
169-
- **Bengali** 🇧🇩
170-
- **Basque** 🇪🇸
171-
- **Bulgarian** 🇧🇬
172-
- **Belarusian** 🇧🇾
173-
- **Burmese** 🇲🇲
174-
- **Catalan** 🇪🇸
175-
- **Chinese (Simplified)** 🇨🇳
176-
- **Chinese (Traditional)** 🇹🇼
177-
- **Chinese (Hong Kong)** 🇭🇰
178-
- **Croatian** 🇭🇷
179-
- **Czech** 🇨🇿
180-
- **Danish** 🇩🇰
181-
- **Dutch** 🇳🇱
182-
- **English (US)** 🇺🇸
183-
- **English (UK)** 🇬🇧
184-
- **English (Australia)** 🇦🇺
185-
- **English (Canada)** 🇨🇦
186-
- **Estonian** 🇪🇪
187-
- **Filipino** 🇵🇭
188-
- **Finnish** 🇫🇮
189-
- **French (France)** 🇫🇷
190-
- **French (Canada)** 🇨🇦
191-
- **Galician** 🇪🇸
192-
- **Georgian** 🇬🇪
193-
- **German** 🇩🇪
194-
- **Greek** 🇬🇷
195-
- **Gujarati** 🇮🇳
196-
- **Hebrew** 🇮🇱
197-
- **Hindi** 🇮🇳
198-
- **Hungarian** 🇭🇺
199-
- **Icelandic** 🇮🇸
200-
- **Indonesian** 🇮🇩
201-
- **Italian** 🇮🇹
202-
- **Japanese** 🇯🇵
203-
- **Kannada** 🇮🇳
204-
- **Kazakh** 🇰🇿
205-
- **Khmer** 🇰🇭
206-
- **Korean** 🇰🇷
207-
- **Kyrgyz** 🇰🇬
208-
- **Lao** 🇱🇦
209-
- **Latvian** 🇱🇻
210-
- **Lithuanian** 🇱🇹
211-
- **Macedonian** 🇲🇰
212-
- **Malay (Malaysia)** 🇲🇾
213-
- **Malayalam** 🇮🇳
214-
- **Marathi** 🇮🇳
215-
- **Mongolian** 🇲🇳
216-
- **Nepali** 🇳🇵
217-
- **Norwegian** 🇳🇴
218-
- **Persian** 🇮🇷
219-
- **Polish** 🇵🇱
220-
- **Portuguese (Brazil)** 🇧🇷
221-
- **Portuguese (Portugal)** 🇵🇹
222-
- **Punjabi** 🇮🇳
223-
- **Romanian** 🇷🇴
224-
- **Russian** 🇷🇺
225-
- **Sinhala** 🇱🇰
226-
- **Slovak** 🇸🇰
227-
- **Slovenian** 🇸🇮
228-
- **Spanish (Spain)** 🇪🇸
229-
- **Spanish (Latin America)** 🌎
230-
- **Spanish (United States)** 🇺🇸
231-
- **Swahili** 🇹🇿
232-
- **Swedish** 🇸🇪
233-
- **Tagalog** 🇵🇭
234-
- **Tamil** 🇮🇳
235-
- **Telugu** 🇮🇳
236-
- **Thai** 🇹🇭
237-
- **Turkish** 🇹🇷
238-
- **Ukrainian** 🇺🇦
239-
- **Urdu** 🇵🇰
240-
- **Vietnamese** 🇻🇳
241-
- **Zulu** 🇿🇦
242-
211+
Afrikaans 🇿🇦 | Albanian 🇦🇱 | Amharic 🇪🇹 | Arabic 🇸🇦 | Armenian 🇦🇲 | Bengali 🇧🇩 | Basque 🇪🇸 | Bulgarian 🇧🇬 | Belarusian 🇧🇾 | Burmese 🇲🇲 | Catalan 🇪🇸 | Chinese (Simplified) 🇨🇳 | Chinese (Traditional) 🇹🇼 | Chinese (Hong Kong) 🇭🇰 | Croatian 🇭🇷 | Czech 🇨🇿 | Danish 🇩🇰 | Dutch 🇳🇱 | English (US) 🇺🇸 | English (UK) 🇬🇧 | English (Australia) 🇦🇺 | English (Canada) 🇨🇦 | Estonian 🇪🇪 | Filipino 🇵🇭 | Finnish 🇫🇮 | French (France) 🇫🇷 | French (Canada) 🇨🇦 | Galician 🇪🇸 | Georgian 🇬🇪 | German 🇩🇪 | Greek 🇬🇷 | Gujarati 🇮🇳 | Hebrew 🇮🇱 | Hindi 🇮🇳 | Hungarian 🇭🇺 | Icelandic 🇮🇸 | Indonesian 🇮🇩 | Italian 🇮🇹 | Japanese 🇯🇵 | Kannada 🇮🇳 | Kazakh 🇰🇿 | Khmer 🇰🇭 | Korean 🇰🇷 | Kyrgyz 🇰🇬 | Lao 🇱🇦 | Latvian 🇱🇻 | Lithuanian 🇱🇹 | Macedonian 🇲🇰 | Malay (Malaysia) 🇲🇾 | Malayalam 🇮🇳 | Marathi 🇮🇳 | Mongolian 🇲🇳 | Nepali 🇳🇵 | Norwegian 🇳🇴 | Persian 🇮🇷 | Polish 🇵🇱 | Portuguese (Brazil) 🇧🇷 | Portuguese (Portugal) 🇵🇹 | Punjabi 🇮🇳 | Romanian 🇷🇴 | Russian 🇷🇺 | Sinhala 🇱🇰 | Slovak 🇸🇰 | Slovenian 🇸🇮 | Spanish (Spain) 🇪🇸 | Spanish (Latin America) 🌎 | Spanish (United States) 🇺🇸 | Swahili 🇹🇿 | Swedish 🇸🇪 | Tagalog 🇵🇭 | Tamil 🇮🇳 | Telugu 🇮🇳 | Thai 🇹🇭 | Turkish 🇹🇷 | Ukrainian 🇺🇦 | Urdu 🇵🇰 | Vietnamese 🇻🇳 | Zulu 🇿🇦
243212
</details>
244213

245214
## Code of Conduct

_config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ gh_sponsor: brownrw8
44
footer_menu: footer
55
theme_color: rebeccapurple
66
defaults:
7-
-
8-
scope:
7+
- scope:
98
path: ""
109
type: "pages"
1110
values:

_data/navigation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
- name: Community
66
link: https://github.com/brownrw8/olelo-honua/discussions
77
- name: More
8-
dropdown:
8+
dropdown:
99
- name: Bug Reports
1010
link: https://github.com/brownrw8/olelo-honua/issues
1111
- name: Feature Requests
12-
link: https://github.com/brownrw8/olelo-honua/pulls
12+
link: https://github.com/brownrw8/olelo-honua/pulls

_includes/follow-button.html

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,9 @@
11
<!-- Place this tag where you want the button to render. -->
2-
<a class="github-button" href="https://github.com/buttons" data-color-scheme="no-preference: light; light: light; dark: dark;" data-size="large" aria-label="Follow @buttons on GitHub">Follow @buttons</a>
2+
<a
3+
class="github-button"
4+
href="https://github.com/buttons"
5+
data-color-scheme="no-preference: light; light: light; dark: dark;"
6+
data-size="large"
7+
aria-label="Follow @buttons on GitHub"
8+
>Follow @buttons</a
9+
>

_includes/head-scripts.html

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,35 @@
11
<!-- Favicon -->
2-
<link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🌺</text></svg>">
2+
<link
3+
rel="icon"
4+
href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>🌺</text></svg>"
5+
/>
36

47
<!-- Meta Tags for SEO -->
5-
<meta charset="UTF-8">
6-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7-
<meta name="description" content="A powerful i18n library for JavaScript, Node.JS, and TypeScript projects. Simplify internationalization with this npm dependency.">
8-
<meta name="keywords" content="i18n, internationalization, npm, Node.JS, JavaScript, TypeScript, localization, programming">
9-
<meta name="author" content="brownrw8">
10-
<meta property="og:title" content="ʻŌlelo Honua: i18n Library for JavaScript/TypeScript/Node.JS">
11-
<meta property="og:description" content="Simplify internationalization with this powerful i18n npm dependency for JavaScript, Node.JS, and TypeScript projects.">
12-
<meta property="og:type" content="website">
13-
<meta property="og:url" content="https://www.olelohonua.com">
14-
<meta property="og:image" content="https://www.olelohonua.com/images/logo.png">
8+
<meta charset="UTF-8" />
9+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
10+
<meta
11+
name="description"
12+
content="A powerful i18n library for JavaScript, Node.JS, and TypeScript projects. Simplify internationalization with this npm dependency."
13+
/>
14+
<meta
15+
name="keywords"
16+
content="i18n, internationalization, npm, Node.JS, JavaScript, TypeScript, localization, programming"
17+
/>
18+
<meta name="author" content="brownrw8" />
19+
<meta
20+
property="og:title"
21+
content="ʻŌlelo Honua: i18n Library for JavaScript/TypeScript/Node.JS"
22+
/>
23+
<meta
24+
property="og:description"
25+
content="Simplify internationalization with this powerful i18n npm dependency for JavaScript, Node.JS, and TypeScript projects."
26+
/>
27+
<meta property="og:type" content="website" />
28+
<meta property="og:url" content="https://www.olelohonua.com" />
29+
<meta
30+
property="og:image"
31+
content="https://www.olelohonua.com/images/logo.png"
32+
/>
1533

1634
<!-- GitHub Buttons -->
17-
<script async defer src="https://buttons.github.io/buttons.js"></script>
35+
<script async defer src="https://buttons.github.io/buttons.js"></script>

0 commit comments

Comments
 (0)