Feeds

Bounteous.com: Discover the Power of Drupal for Enhanced Operational Efficiency and Security for Healthcare Systems

Planet Drupal - Fri, 2024-08-16 02:44
Healthcare systems consistently rely on technology to provide accurate and timely care. Drupal, an integrated CMS, can help meet this goal.
Categories: FLOSS Project Planets

Bounteous.com: A New Age of Drupal: Drupal CMS

Planet Drupal - Fri, 2024-08-16 02:44
Drupal enables amazing capabilities for DXPs, but specialized talent is required. At DrupalCon NA, a new Drupal was announced for those without a technical background, Drupal CMS.
Categories: FLOSS Project Planets

Bounteous.com: A Guide to the Latest Security Updates for Drupal 7 Users

Planet Drupal - Fri, 2024-08-16 02:44
Discover important security updates and changes happening in Drupal 7 and how you could benefit from upgrading to Drupal 10!
Categories: FLOSS Project Planets

Bounteous.com: Best Practices With Composable Drupal

Planet Drupal - Fri, 2024-08-16 02:44
Discover how Drupal enables organizations to adapt to evolving business needs with agility and ease.
Categories: FLOSS Project Planets

Bounteous.com: The Evolution of Drupal: Discover the Features D7 Users Are Missing Out On

Planet Drupal - Fri, 2024-08-16 02:44
Organizations still using Drupal 7 are missing out on the flexibility, customization options, scalability, and marketing capabilities available in the newer versions. Drupal 10 allows for the management of consistent and engaging digital experiences across various channels, enhances search engine optimization, and enables web teams to deliver content more efficiently.
Categories: FLOSS Project Planets

Bounteous.com: Moderate All the Content: Establishing Workflows in Drupal 10

Planet Drupal - Fri, 2024-08-16 02:44
Learn about workflow configuration and customizations to empower your website’s content approver and publisher roles.
Categories: FLOSS Project Planets

Bounteous.com: Composability and Drupal: Going Headless at Scale

Planet Drupal - Fri, 2024-08-16 02:44
Discover how composable architectures offer unparalleled speed, agility, and flexibility to empower organizations in navigating the ever-changing landscape of technological advancements and evolving consumer needs, and how Drupal can be a key part of a composable solution!
Categories: FLOSS Project Planets

Bounteous.com: Upgrading to Drupal 10 (And Beyond) With Composer

Planet Drupal - Fri, 2024-08-16 02:44
Every iteration of Drupal brings a multitude of security improvements, accessibility improvements, and a host of new features created by the Drupal community.
Categories: FLOSS Project Planets

Bounteous.com: Introduction to ChatOps with Acquia BLT and Slack

Planet Drupal - Fri, 2024-08-16 02:44
Learn how to set up ChatOps with Acquia BLT to improve your team’s communication and efficiency by automatically sharing Drupal DevOps messaging to a single channel.
Categories: FLOSS Project Planets

Bounteous.com: What’s New in Acquia Site Studio 6.9?

Planet Drupal - Fri, 2024-08-16 02:44
Acquia has been busy releasing new features for their low-code, drag-and-drop solution called Site Studio!
Categories: FLOSS Project Planets

Bounteous.com: Use the Acquia CMS Headless Beta to Improve Headless Applications

Planet Drupal - Fri, 2024-08-16 02:44
As a developer, building a partially or fully headless Drupal site can feel like a daunting task. There are always more questions than answers when getting started.
Categories: FLOSS Project Planets

Bounteous.com: Building Enterprise Drupal Sites with Acquia Build and Launch Tool (BLT)

Planet Drupal - Fri, 2024-08-16 02:44
Learn more about Acquia’s Built and Launch Tool (BLT) and how this Drupal-specific extensible toolset can help you build, test, and deploy your code.
Categories: FLOSS Project Planets

Bounteous.com: Drupal 10: Uncovering New Features and Benefits

Planet Drupal - Fri, 2024-08-16 02:44
Drupal 10 continues to pave the way for great user experiences into the future. Check out the new features and benefits that Drupal 10 has to offer!
Categories: FLOSS Project Planets

Bounteous.com: Your Team's Technical Guide to Drupal Code Reviews

Planet Drupal - Fri, 2024-08-16 02:44
A checklist and technical Guide to complete Drupal code reviews to improve your codebase and processes.
Categories: FLOSS Project Planets

Bounteous.com: The Acquia Triple Certification: Distinguishing Yourself as a Drupal Developer

Planet Drupal - Fri, 2024-08-16 02:44
Distinguish yourself as a Drupal Developer by getting Acquia Triple Certified. Learn more about the exams and the impact they can have on your career.
Categories: FLOSS Project Planets

Bounteous.com: PHP 7 to 8: Entering the Modern Era of Programming Languages

Planet Drupal - Fri, 2024-08-16 02:44
Whether it’s using new syntax, experiencing the speed boosts of the JIT compiler, or trying out new features of the language, PHP 8 has many improvements that developers and Drupal sites can benefit from.
Categories: FLOSS Project Planets

Bounteous.com: Our Guide to Upgrading Your Site with Drupal 9

Planet Drupal - Fri, 2024-08-16 02:44
Learn how to successfully migrate your Drupal 7 site to the new Drupal 9 platform, and keep these critical considerations in mind as you plan your future steps.
Categories: FLOSS Project Planets

Bounteous.com: Acquia Cloud IDE: First Impressions From a Senior Developer

Planet Drupal - Fri, 2024-08-16 02:44
Acquia Cloud IDE may be the next big thing in local Drupal development. Learn the basics of Cloud IDE and hear our first impressions of the product.
Categories: FLOSS Project Planets

Localizing spin box prefixes/suffixes

Planet KDE - Fri, 2024-08-16 01:45

KDE Frameworks 6.5 brings a little new feature for localizing prefix and suffix texts in spin boxes. It’s also a good reminder of the level of detail we have to pay attention to when preparing our software for being translated.

The problem

Qt spin boxes can have inline prefix and suffix strings. That’s commonly used for units.

There’s multiple challenges when localizing this:

  • Plurals: Depending on the selected quantity different plural forms for prefixes/suffixes might be needed (e.g. “1 cake” vs “3 cakes”). How many plural forms there are depends on the language and can be anywhere between none (e.g. Japanese) and six (e.g. Arabic). CLDR’s Language Plural Rules gives you an idea of the complexity.
  • Word order: Not all languages place those texts in the same position. For a percent value for example English uses the % sign as a suffix, while Turkish uses it as a prefix.

So just setting a fixed string doesn’t cut it.

Existing solutions

None of that is new, and for the plural handling we do have an existing solution in form of KPluralHandlingSpinBox in KF::TextWidgets. It takes a suffix in form of a KLocalizedString, which it reevaluates each time its value changes to show the correct plural form.

This works but has a number of downsides:

  • It’s not solving the word order problem, and it’s only handing suffixes.
  • It’s using inheritance and thus is harder to integrate with custom or otherwise more complex existing spin box code.
  • The use of inheritance is also limiting it to QSpinBox, not helping with e.g. QDoubleSpinBox.
New API in KF::I18n

Starting with an idea by Emir Sarı and Lukas Sommer for a solution to the word ordering problem and a suggestion by me to generalize the same approach to cover plural handling as well we ended up with two new methods in KF::I18n.

KLocalization::setupSpinBoxFormatString is the one you’ll most commonly need. It allows to set a KLocalizedString format string on any spin box instance. That format string must contain the special placeholder %v, which represents the current spin box value.

Texts before the %v end up in the prefix and the part after it in the suffix, giving translations control over the word order. This can be used both with and without considering plural forms, as shown in the example below.

// with plural QSpinBox spinBox; KLocalization::setupSpinBoxFormatString(&spinBox, ki18np("Baking %v cake", "Baking %v cakes")); // without plural QDoubleSpinBox doubleSpinBox; KLocalization::setupSpinBoxFormatString(&doubleSpinBox, ki18n("%v%"));

As this isn’t relying on inheritance it can be used on QSpinBox, QDoubleSpinBox or any subclass thereof. Being part of KF::I18n also means this is very likely available without needing additional dependencies. All of this should help with a much wider adoption than we ever had for KPluralHandlingSpinBox.

The second new method is KLocalization::retranslateSpinBoxFormatString, which explicitly triggers reevaluating the format string. That’s automatically called when the spin box value changes, but if you are for example supporting runtime language changes you might have the need for manually triggering this as well.

What’s left to do

We need to make use of this. It’s an easy way to contribute, and helps making our software better in other languages than English :)

There’s also the question how to address these issues in QML UIs. Qt’ QML spin box control doesn’t have support for inline prefixes/suffixes, but the problems don’t go away by placing the those texts on the outside.

Categories: FLOSS Project Planets

Pages