Module: Jekyll::L10n

Includes:
Constants
Defined in:
lib/jekyll-l10n.rb,
lib/jekyll-l10n/errors.rb,
lib/jekyll-l10n/version.rb,
lib/jekyll-l10n/constants.rb,
lib/jekyll-l10n/po_file/loader.rb,
lib/jekyll-l10n/po_file/merger.rb,
lib/jekyll-l10n/po_file/reader.rb,
lib/jekyll-l10n/po_file/writer.rb,
lib/jekyll-l10n/po_file/manager.rb,
lib/jekyll-l10n/jekyll/generator.rb,
lib/jekyll-l10n/extraction/logger.rb,
lib/jekyll-l10n/jekyll/url_filter.rb,
lib/jekyll-l10n/utils/html_parser.rb,
lib/jekyll-l10n/utils/debug_logger.rb,
lib/jekyll-l10n/utils/error_handler.rb,
lib/jekyll-l10n/utils/html_elements.rb,
lib/jekyll-l10n/extraction/extractor.rb,
lib/jekyll-l10n/po_file/path_builder.rb,
lib/jekyll-l10n/utils/text_validator.rb,
lib/jekyll-l10n/jekyll/localized_page.rb,
lib/jekyll-l10n/utils/file_operations.rb,
lib/jekyll-l10n/utils/html_text_utils.rb,
lib/jekyll-l10n/utils/text_normalizer.rb,
lib/jekyll-l10n/utils/url_transformer.rb,
lib/jekyll-l10n/translation/translator.rb,
lib/jekyll-l10n/utils/logger_formatter.rb,
lib/jekyll-l10n/utils/url_path_builder.rb,
lib/jekyll-l10n/extraction/result_saver.rb,
lib/jekyll-l10n/extraction/config_loader.rb,
lib/jekyll-l10n/utils/po_entry_converter.rb,
lib/jekyll-l10n/utils/page_locales_config.rb,
lib/jekyll-l10n/utils/site_config_accessor.rb,
lib/jekyll-l10n/utils/translation_resolver.rb,
lib/jekyll-l10n/jekyll/post_write_processor.rb,
lib/jekyll-l10n/jekyll/regeneration_checker.rb,
lib/jekyll-l10n/translation/html_translator.rb,
lib/jekyll-l10n/extraction/compendium_merger.rb,
lib/jekyll-l10n/translation/libre_translator.rb,
lib/jekyll-l10n/extraction/dom_text_extractor.rb,
lib/jekyll-l10n/utils/xpath_reference_generator.rb,
lib/jekyll-l10n/extraction/compendium_translator.rb,
lib/jekyll-l10n/extraction/html_string_extractor.rb,
lib/jekyll-l10n/translation/block_text_extractor.rb,
lib/jekyll-l10n/extraction/dom_attribute_extractor.rb,
lib/jekyll-l10n/jekyll/post_write_html_reprocessor.rb,
lib/jekyll-l10n/utils/external_link_icon_preserver.rb,
lib/jekyll-l10n/translation/page_translation_loader.rb

Overview

Main plugin namespace

Defined Under Namespace

Modules: BlockTextExtractor, Constants, DomAttributeExtractor, DomTextExtractor, Errors, ExternalLinkIconPreserver, FileOperations, HtmlElements, HtmlTextUtils, LoggerFormatter, TextNormalizer, UrlFilter, UrlPathBuilder, XPathReferenceGenerator Classes: CompendiumMerger, CompendiumTranslator, DebugLogger, ErrorHandler, ExtractionConfigLoader, ExtractionLogger, ExtractionResultSaver, Extractor, Generator, HtmlParser, HtmlStringExtractor, HtmlTranslator, LibreTranslator, LocalizedPage, PageLocalesConfig, PageTranslationLoader, PoEntryConverter, PoFileLoader, PoFileManager, PoFileMerger, PoFileReader, PoFileWriter, PoPathBuilder, PostWriteHtmlReprocessor, PostWriteProcessor, RegenerationChecker, SiteConfigAccessor, TextValidator, TranslationResolver, Translator, UrlTransformer

Constant Summary collapse

MIN_TRANSLATABLE_LENGTH =

Module-level convenience constants that reference the Constants module

Constants::MIN_TRANSLATABLE_LENGTH
DEFAULT_LOCALES_DIR =
Constants::DEFAULT_LOCALES_DIR
DEFAULT_FALLBACK_MODE =
Constants::DEFAULT_FALLBACK_MODE
DEFAULT_TRANSLATABLE_ATTRIBUTES =
Constants::DEFAULT_TRANSLATABLE_ATTRIBUTES
VERSION =

The version of the jekyll-l10n gem.

Updated with each release to reflect the current version.

'1.0.0'

Constants included from Constants

Constants::BACKTRACE_CONTEXT_LENGTH, Constants::DEFAULT_LIBRETRANSLATE_API_URL, Constants::DEFAULT_LIBRETRANSLATE_BATCH_SIZE, Constants::DEFAULT_LIBRETRANSLATE_FORMAT, Constants::DEFAULT_LIBRETRANSLATE_PROGRESS_INTERVAL, Constants::DEFAULT_LIBRETRANSLATE_RETRY_ATTEMPTS, Constants::DEFAULT_LIBRETRANSLATE_RETRY_DELAY, Constants::DEFAULT_LIBRETRANSLATE_SOURCE_LOCALE, Constants::DEFAULT_LIBRETRANSLATE_STOP_ON_ERROR, Constants::DEFAULT_LIBRETRANSLATE_TIMEOUT, Constants::FALLBACK_MODE_EMPTY, Constants::FALLBACK_MODE_ENGLISH, Constants::FALLBACK_MODE_MARKER, Constants::LOCALE_PATTERN, Constants::LOG_THRESHOLD_SHORT, Constants::LOG_TRUNCATE_LONG, Constants::LOG_TRUNCATE_MEDIUM, Constants::LOG_TRUNCATE_SHORT, Constants::PO_LINE_LENGTH, Constants::PO_SHORT_LINE_LENGTH, Constants::UNTRANSLATED_MARKER

Class Method Summary collapse

Class Method Details

.transform(html, locale, baseurl) ⇒ String

Transform URLs in HTML to include locale prefix.

Walks the HTML document and transforms relative URLs to be locale-aware by adding locale prefixes. Useful for translating internal links in localized pages.

Examples:

html_with_locale_urls = Jekyll::L10n.transform(html, 'es', '/mysite')

Parameters:

  • html (String)

    HTML content to transform

  • locale (String)

    Locale code for URL prefix (e.g., ‘es’, ‘fr’)

  • baseurl (String)

    Base URL for relative URL transformation

Returns:

  • (String)

    HTML with transformed URLs



255
256
257
# File 'lib/jekyll-l10n.rb', line 255

def self.transform(html, locale, baseurl)
  UrlTransformer.transform(html, locale, baseurl)
end