πŸ€– AI Translator Guide - Project 96

Dynamic guide optimized for AI tools with project-specific endpoints

πŸ’‘ Quick Start: This guide is automatically configured for InventarListen (Project 96). All examples use your project ID.
πŸ€– AI Integration Ready: Optimized for Replit.com and other AI platforms. No URL encoding needed for POST requests!

πŸ“‹ Naming Convention

All string constants follow this pattern: area.section.string

πŸ’‘ API Usage: When creating strings via API, you only specify the string identifier (last part), not the full key!
Example: For public.home.welcome: API Usage: Send "key": "welcome", not "key": "public.home.welcome"
🎯 Frontend Usage: When replacing text on web pages, you MUST use the FULL KEY with dots!
Example: Replace "Welcome to our website!" with public.home.welcome in your HTML/JavaScript
πŸš€ New Projects: When you create a new project, it automatically comes with default areas and sections ready to use!

Areas

  • admin - Admin pages
  • public - Public pages
βœ… Project Areas: This project has 2 area(s) defined.

Sections

  • brand
  • category
  • contact
  • dashboard
  • department
  • features
  • general
  • inventory
  • loan
  • location
  • login
  • mail
  • menu
  • other
  • payment
  • plan
  • profile
  • register
  • report
  • settings
  • suppliers
  • tags
  • title

  • about
  • contact
  • features
  • general
  • home
  • login
  • mail
  • menu
  • other
  • payment
  • plan
  • register
  • title
πŸ“Š Total Sections: 36 section(s) across all areas.

String (Variable Name)

  • Max 20 characters
  • Lowercase letters and underscores only (a-z, _)
  • No numbers or other special characters
  • Examples: welcome, savebtn, edittext
πŸ“Š Project Stats: 1748 string(s) in this project.

πŸš€ AI-Optimized Workflow

Use these endpoints specifically designed for AI tools with simplified authentication:

βœ… AVAILABLE ENDPOINTS:

Your AI can use these endpoints for different operations:

πŸ’‘ RECOMMENDED: Use POST /api/v1/projects/96/strings/ai for AI operations, but other endpoints are also valid!

⚠️ IMPORTANT: Always start with "action": "info" to get the project structure (areas and sections) before creating strings!

1. Get Project Info

Start by getting information about your project:

POST https://la.deltascripts.com/api/v1/projects/96/strings/ai
Request:
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "info"
  }'
Response:
{
  "success": true,
  "project_id": 96,
  "project_name": "InventarListen",
  "available_areas": ["admin", "public"],
  "total_strings": 1748,
  "api_endpoints": {
    "find_similar": "POST https://la.deltascripts.com/api/v1/projects/96/strings/ai",
    "create_string": "POST https://la.deltascripts.com/api/v1/projects/96/strings/ai",
    "list_strings": "POST https://la.deltascripts.com/api/v1/projects/96/strings/ai"
  }
}

2. Get Existing Translations (Multi-Language)

🎯 PRIMARY METHOD: Get both English and Norwegian translations for your project. This helps you see what's already available before creating new strings. No authentication required for AI!

βœ… AI-FRIENDLY: This endpoint is optimized for AI access - no authentication tokens needed!
GET https://la.deltascripts.com/api/v1/projects/96/translations
Request (Get all translations - both languages):
curl -X GET "https://la.deltascripts.com/api/v1/projects/96/translations?languages=en,no"
Request (Specific area - both languages):
curl -X GET "https://la.deltascripts.com/api/v1/projects/96/translations?languages=en,no&area=admin"
Request (Specific area and section - both languages):
curl -X GET "https://la.deltascripts.com/api/v1/projects/96/translations?languages=en,no&area=admin§ion=dashboard"
Response:
{
  "success": true,
  "project_id": 96,
  "languages": ["en", "no"],
  "area": "admin",
  "section": "all",
  "translations": [
    {
      "string_id": 123,
      "key": "welcome",
      "area": "admin",
      "section": "dashboard",
      "status": "active",
      "base_text": "Welcome to the admin panel",
      "translations": {
        "en": {
          "text": "Welcome to the admin panel",
          "state": "approved",
          "updated_at": "2025-01-27 10:30:00"
        },
        "no": {
          "text": "Velkommen til admin-panelet",
          "state": "approved",
          "updated_at": "2025-01-27 10:30:00"
        }
      }
    }
  ],
  "statistics": {
    "total_strings": 25,
    "total_translations": 50,
    "coverage_percentage": 100.0,
    "by_language": {
      "en": 25,
      "no": 25
    }
  }
}
πŸ’‘ Important: Both English and Norwegian translations are stored in the translations table and treated equally. English is no longer treated as a "base language" - both languages have the same status and can be updated independently.

3. Find Similar Strings (Area-Specific)

Check for existing strings before creating new ones. Always specify the area to avoid confusion:

POST https://la.deltascripts.com/api/v1/projects/96/strings/ai
Request:
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "find_similar",
    "text": "Welcome to our website!",
    "area": "public",
    "limit": 10
  }'
Response:
{
   "success": true,
   "search_text": "Welcome to our website!",
   "search_area": "public",
   "total_found": 3,
   "results": {
     "exact_matches": [
       {
         "id": 123,
         "full_key": "public.home.welcome",
         "base_text": "Welcome to our website!",
         "area_name": "public",
         "section_name": "home",
         "match_type": "exact_match",
         "similarity_score": 100
       }
     ],
     "partial_matches": []
   },
   "recommendations": {
     "exact_match_found": "Use existing string instead of creating duplicate",
     "suggested_action": "use_existing"
   },
   "suggested_alternatives": [
     {
       "action": "use_existing",
       "string_id": 123,
       "full_key": "public.home.welcome",
       "base_text": "Welcome to our website!",
       "api_endpoints": {
         "view_string": "GET https://la.deltascripts.com/api/v1/projects/96/strings/123"
       }
     }
   ]
 }

4. Create New String

Create strings with intelligent feedback and duplicate detection:

⚠️ MANDATORY: You MUST use "action": "create_with_translations" to create strings! Both English and Norwegian translations are required and will be stored in the translations table.
⚠️ IMPORTANT: The base_text field must contain the English text, not the Norwegian translation!
Correct: "base_text": "Welcome to our website!"
Wrong: "base_text": "Velkommen til vΓ₯rt nettsted!"
Norwegian translations should be added using the translations API, not as base_text.
πŸ”‘ API Key Usage: When using the API, use only the string identifier (last part) as the key:
Correct: "key": "welcome" (for public.home.welcome)
Wrong: "key": "public.home.welcome"
The full key is automatically constructed from area + section + key
⚠️ IMPORTANT - Frontend Usage: When replacing text on web pages or in your application, you MUST use the FULL KEY with dots:
Correct: public.home.welcome, admin.dashboard.savebtn
Wrong: welcome, savebtn
Example: Replace "Welcome to our website!" with public.home.welcome in your HTML/JavaScript
POST https://la.deltascripts.com/api/v1/projects/96/strings/ai
Request (MANDATORY - Create with both translations):
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
   -H "Content-Type: application/json" \
   -d '{
     "action": "create_with_translations",
     "area": "public",
     "section": "home",
     "base_text": "Welcome to our website!",
     "norwegian_text": "Velkommen til vΓ₯rt nettsted!",
     "suggested_key": "welcome"
   }'
Success Response:
{
   "success": true,
   "message": "String and Norwegian translation created successfully",
   "data": {
     "id": 123,
     "full_key": "public.home.welcome",
     "base_text": "Welcome to our website!",
     "norwegian_text": "Velkommen til vΓ₯rt nettsted!",
     "area": "public",
     "section": "home",
     "status": "active",
     "created_at": "2025-01-27 10:30:00"
   },
   "translations": {
     "english": "Welcome to our website!",
     "norwegian": "Velkommen til vΓ₯rt nettsted!"
   },
  "api_endpoints": {
    "view_string": "GET https://la.deltascripts.com/api/v1/projects/96/strings/123",
    "update_string": "PUT https://la.deltascripts.com/api/v1/projects/96/strings/123",
    "delete_string": "DELETE https://la.deltascripts.com/api/v1/projects/96/strings/123"
  }
}
Duplicate Detection Response:
{
   "success": false,
   "error": "String key already exists",
   "duplicate_info": {
     "id": 123,
     "full_key": "public.home.welcome",
     "existing_text": "Welcome to our website!",
     "status": "active"
   },
  "suggestions": {
    "use_existing": "The string already exists with ID 123",
    "update_existing": "Use PUT /api/v1/projects/96/strings/123 to update the existing string"
  },
  "api_endpoints": {
    "update_existing": "PUT https://la.deltascripts.com/api/v1/projects/96/strings/123",
    "view_existing": "GET https://la.deltascripts.com/api/v1/projects/96/strings/123"
  }
}

5. Add Translations

After creating a string with English base_text, add Norwegian translations:

πŸ’‘ Translation Workflow:
  1. Create string with English base_text
  2. Add Norwegian translation using the translations API
  3. Use the unified endpoint for efficient batch operations
POST https://la.deltascripts.com/api/v1/projects/96/translations/unified
Request (Add Norwegian translation):
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/translations/unified" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -d '{
    "translations": [
      {
        "key": "welcome",
        "lang": "no",
        "text": "Velkommen til vΓ₯rt nettsted!"
      }
    ]
  }'
Success Response:
{
  "success": true,
  "message": "Unified update completed",
  "data": {
    "strings_updated": [],
    "translations_updated": [
      {
        "key": "welcome",
        "lang": "no",
        "text": "Velkommen til vΓ₯rt nettsted!",
        "status": "created"
      }
    ],
    "errors": [],
    "warnings": []
  }
}

6. Get Project Statistics

Get detailed statistics about strings distribution across areas and sections:

POST https://la.deltascripts.com/api/v1/projects/96/strings/ai
Request:
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
   -H "Content-Type: application/json" \
   -d '{
     "action": "stats"
   }'
Response:
{
   "success": true,
   "project_id": 96,
   "summary": {
     "total_strings": 150,
     "total_areas": 3,
     "total_sections": 12
   },
   "statistics": {
     "by_area": [
       {
         "area_name": "admin",
         "string_count": 45
       },
       {
         "area_name": "member",
         "string_count": 67
       },
       {
         "area_name": "public",
         "string_count": 38
       }
     ],
     "by_section": {
       "admin": [
         {
           "section_name": "dashboard",
           "string_count": 25
         },
         {
           "section_name": "settings",
           "string_count": 20
         }
       ],
       "public": [
         {
           "section_name": "home",
           "string_count": 20
         },
         {
           "section_name": "login",
           "string_count": 18
         }
       ]
     },
           "by_status": [
        {
          "status": "active",
          "count": 140
        },
        {
          "status": "draft",
          "count": 10
        }
      ],
      "status_by_area": {
        "admin": [
          {
            "status": "active",
            "count": 40
          },
          {
            "status": "draft",
            "count": 5
          }
        ],
        "public": [
          {
            "status": "active",
            "count": 35
          },
          {
            "status": "draft",
            "count": 3
          }
        ]
      },
      "status_by_section": {
        "admin": {
          "dashboard": [
            {
              "status": "active",
              "count": 25
            },
            {
              "status": "draft",
              "count": 2
            }
          ],
          "settings": [
            {
              "status": "active",
              "count": 15
            },
            {
              "status": "draft",
              "count": 3
            }
          ]
        },
        "public": {
          "home": [
            {
              "status": "active",
              "count": 20
            }
          ],
          "login": [
            {
              "status": "active",
              "count": 15
            },
            {
              "status": "draft",
              "count": 3
            }
          ]
        }
      },
     "recent_activity": [
       {
         "date": "2025-01-27",
         "created_count": 5
       },
       {
         "date": "2025-01-26",
         "created_count": 3
       }
     ]
   }
 }

7. List Strings

Get all strings in your project or filter by area/section:

POST https://la.deltascripts.com/api/v1/projects/96/strings/ai
Request (All strings):
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "list"
  }'
Request (Filtered by area):
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "list",
    "area": "public",
    "section": "home"
  }'

🎯 Best Practices for AI

⚠️ Important Rules:

πŸ”§ PRACTICAL EXAMPLE - How to Create Missing Keys

πŸ“ Step-by-Step Example:

If your AI needs to create the missing key admin.general.settings, here's exactly how to do it:

βœ… CORRECT WAY - Create Missing Key
1. First, check if the key already exists:
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "find_similar",
    "text": "Settings",
    "area": "admin",
    "section": "general"
  }'
2. If no exact match found, create the new string:
curl -X POST "https://la.deltascripts.com/api/v1/projects/96/strings/ai" \
  -H "Content-Type: application/json" \
  -d '{
    "action": "create_with_translations",
    "area": "admin",
    "section": "general",
    "base_text": "Settings",
    "norwegian_text": "Innstillinger",
    "suggested_key": "settings"
  }'
3. Expected Success Response:
{
  "success": true,
  "message": "String and Norwegian translation created successfully",
  "data": {
    "id": 1234,
    "full_key": "admin.general.settings",
    "base_text": "Settings",
    "norwegian_text": "Innstillinger",
    "area": "admin",
    "section": "general",
    "status": "active",
    "created_at": "2025-01-27 10:30:00"
  }
}
βœ… ALTERNATIVE ENDPOINTS:

You can also use these endpoints for different operations:

πŸ’‘ Common Use Cases

Admin Area

Available sections: brand, category, contact and 20 more

πŸ” Find Similar Strings:
{
  "action": "find_similar",
  "text": "Welcome to our admin page",
  "area": "admin"
}
βž• Create New String:
{
   "action": "create_with_translations",
   "area": "admin",
   "section": "brand",
   "base_text": "Welcome to our admin area",
   "norwegian_text": "Velkommen til vΓ₯rt admin omrΓ₯de"
 }

This will create a string with full key: admin.brand.welcome

Public Area

Available sections: about, contact, features and 10 more

πŸ” Find Similar Strings:
{
  "action": "find_similar",
  "text": "Welcome to our public page",
  "area": "public"
}
βž• Create New String:
{
   "action": "create_with_translations",
   "area": "public",
   "section": "about",
   "base_text": "Welcome to our public area",
   "norwegian_text": "Velkommen til vΓ₯rt public omrΓ₯de"
 }

This will create a string with full key: public.about.welcome

πŸ”— Quick Reference

Action Endpoint Purpose
Get Project Info POST /api/v1/projects/96/strings/ai Get project details and available areas
Find Similar Strings POST /api/v1/projects/96/strings/ai Check for existing strings (area-specific)
Create String (MANDATORY) POST /api/v1/projects/96/strings/ai Create new string with both English and Norwegian translations
Get Statistics POST /api/v1/projects/96/strings/ai Get detailed statistics by area/section
List Strings POST /api/v1/projects/96/strings/ai Get all strings or filter by area/section
βœ… Success Tips:
πŸ”— Project URL: https://la.deltascripts.com/api/v1/projects/96/strings/ai
πŸ“– Full Documentation: General Translator Guide

🚨 TROUBLESHOOTING - If Your AI Gets 404 Errors

πŸ” Problem:

Your AI reports getting "Not Found" or 404 errors when trying to create keys.

βœ… Solution:

Recommended endpoint for AI operations:

POST https://la.deltascripts.com/api/v1/projects/96/strings/ai
πŸ“‹ Required JSON format:
{
  "action": "create_with_translations",
  "area": "admin",
  "section": "general", 
  "base_text": "Your English Text",
  "norwegian_text": "Din norske tekst",
  "suggested_key": "yourkey"
}
🎯 Key Points:

← Back to API Documentation