addons-cm/website_sale_aplicoop/static/src/js/i18n_helpers.js
snt 6fbc7b9456 [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings
- Remove redundant string= from 17 field definitions where name matches string value (W8113)
- Convert @staticmethod to instance methods in selection methods for proper self.env._() access
- Fix W8161 (prefer-env-translation) by using self.env._() instead of standalone _()
- Fix W8301/W8115 (translation-not-lazy) by proper placement of % interpolation outside self.env._()
- Remove unused imports of odoo._ from group_order.py and sale_order_extension.py
- All OCA linting warnings in website_sale_aplicoop main models are now resolved

Changes:
- website_sale_aplicoop/models/group_order.py: 21 field definitions cleaned
- website_sale_aplicoop/models/sale_order_extension.py: 5 field definitions cleaned + @staticmethod conversion
- Consistent with OCA standards for addon submission
2026-02-18 17:54:43 +01:00

66 lines
1.9 KiB
JavaScript

/**
* DEPRECATED: Use i18n_manager.js instead
*
* This file is kept for backwards compatibility only.
* All translation logic has been moved to i18n_manager.js which
* fetches translations from the server endpoint /eskaera/i18n
*
* Migration guide:
* OLD: window.getCheckoutLabels()
* NEW: i18nManager.getAll()
*
* OLD: window.formatCurrency(amount)
* NEW: i18nManager.formatCurrency(amount)
*
* Copyright 2025 Criptomart
* License AGPL-3.0 or later
*/
(function () {
"use strict";
// Keep legacy functions as wrappers for backwards compatibility
/**
* DEPRECATED - Use i18nManager.getAll() or i18nManager.get(key) instead
*/
window.getCheckoutLabels = function (key) {
if (window.i18nManager && window.i18nManager.initialized) {
if (key) {
return window.i18nManager.get(key);
}
return window.i18nManager.getAll();
}
// Fallback if i18nManager not yet initialized
return key ? key : {};
};
/**
* DEPRECATED - Use i18nManager.getAll() instead
*/
window.getSearchLabels = function () {
if (window.i18nManager && window.i18nManager.initialized) {
return {
searchPlaceholder: window.i18nManager.get("search_products"),
noResults: window.i18nManager.get("no_results"),
};
}
return {
searchPlaceholder: "Search products...",
noResults: "No products found",
};
};
/**
* DEPRECATED - Use i18nManager.formatCurrency(amount) instead
*/
window.formatCurrency = function (amount) {
if (window.i18nManager) {
return window.i18nManager.formatCurrency(amount);
}
// Fallback
return "€" + parseFloat(amount).toFixed(2);
};
console.log("[i18n_helpers] DEPRECATED - Use i18n_manager.js instead");
})();