Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translated metadata is not cached if locale contains country code #166

Closed
antonio-rojas opened this issue Jan 18, 2018 · 3 comments
Closed

Comments

@antonio-rojas
Copy link
Contributor

Using appstream 0.11.7. If LANG=xx_XX and there is no translation in the xml metadata for lang=xx_XX, appstream should use the translation for lang=xx instead. Most packages don't ship specific translations for language variants in their metadata, so this makes descriptions be always untranslated in Discover even if there are available translations in the metadata.

@ximion
Copy link
Owner

ximion commented Apr 3, 2018

I couldn't reproduce this, everything seems to work as expected.
AppStream has routines to split locales and compare languages, see https://github.com/ximion/appstream/blob/master/src/as-utils.c#L691 and https://github.com/ximion/appstream/blob/master/src/as-utils.c#L759
That seems to work without problems here, so I would need some way to reproduce this easily.

@antonio-rojas
Copy link
Contributor Author

antonio-rojas commented Apr 3, 2018

LANG=es_ES appstreamcli dump org.kde.dolphin.desktop

<?xml version="1.0" encoding="utf-8"?>
<component type="desktop-application">
  <id>org.kde.dolphin.desktop</id>
  <name xml:lang="es_ES">Dolphin</name>
  <summary xml:lang="es_ES">File Manager</summary>
  <project_license>GPL-2.0+</project_license>
  <project_group>KDE</project_group>
  <description>
    <p xml:lang="es_ES">Dolphin is a lightweight file manager. It has been designed with ease of use and simplicity in mind, while still allowing flexibility and customisation. This means that you can do your file management exactly the way you want to do it.</p>
    <p xml:lang="es_ES">Features:</p>
    <ul>
      <li xml:lang="es_ES">Navigation (or breadcrumb) bar for URLs, allowing you to quickly navigate through the hierarchy of files and folders.</li>
      <li xml:lang="es_ES">Supports several different kinds of view styles and properties and allows you to configure the view exactly how you want it.</li>
      <li xml:lang="es_ES">Split view, allowing you to easily copy or move files between locations.</li>
      <li xml:lang="es_ES">Additional information and shortcuts are available as dock-able panels, allowing you to move them around freely and display exactly what you want.</li>
      <li xml:lang="es_ES">Multiple tab support</li>
      <li xml:lang="es_ES">Informational dialogues are displayed in an unobtrusive way.</li>
      <li xml:lang="es_ES">Undo/redo support</li>
      <li xml:lang="es_ES">Transparent network access through the KIO system.</li>
    </ul>
  </description>
  <pkgname>dolphin</pkgname>
  <categories>
    <category>System</category>
    <category>FileTools</category>
    <category>FileManager</category>
  </categories>
  <url type="homepage">https://dolphin.kde.org/</url>
  <url type="bugtracker">https://bugs.kde.org/enter_bug.cgi?format=guided&amp;product=dolphin</url>
  <url type="help">https://docs.kde.org/?application=dolphin</url>
  <icon type="cached" width="64" height="64">dolphin_system-file-manager.png</icon>
  <icon type="cached" width="128" height="128">dolphin_system-file-manager.png</icon>
  <icon type="stock">system-file-manager</icon>
  <launchable type="desktop-id">org.kde.dolphin.desktop</launchable>
  <screenshots>
    <screenshot type="default">
      <image type="source">https://kde.org/images/screenshots/dolphin.png</image>
    </screenshot>
  </screenshots>
  <mimetypes>
    <mimetype>inode/directory</mimetype>
  </mimetypes>
  <provides>
    <binary>dolphin</binary>
  </provides>
</component>

vs
LANG=es appstreamcli dump org.kde.dolphin.desktop

<?xml version="1.0" encoding="utf-8"?>
<component type="desktop-application">
  <id>org.kde.dolphin.desktop</id>
  <name>Dolphin</name>
  <name xml:lang="es">Dolphin</name>
  <summary>File Manager</summary>
  <summary xml:lang="es">Administrador de archivos</summary>
  <project_license>GPL-2.0+</project_license>
  <project_group>KDE</project_group>
  <description>
    <p>Dolphin is a lightweight file manager. It has been designed with ease of use and simplicity in mind, while still allowing flexibility and customisation. This means that you can do your file management exactly the way you want to do it.</p>
    <p>Features:</p>
    <ul>
      <li>Navigation (or breadcrumb) bar for URLs, allowing you to quickly navigate through the hierarchy of files and folders.</li>
      <li>Supports several different kinds of view styles and properties and allows you to configure the view exactly how you want it.</li>
      <li>Split view, allowing you to easily copy or move files between locations.</li>
      <li>Additional information and shortcuts are available as dock-able panels, allowing you to move them around freely and display exactly what you want.</li>
      <li>Multiple tab support</li>
      <li>Informational dialogues are displayed in an unobtrusive way.</li>
      <li>Undo/redo support</li>
      <li>Transparent network access through the KIO system.</li>
    </ul>
    <p xml:lang="es">Dolphin es un administrador de archivos ligero. Se ha dise?ado teniendo en cuenta la facilidad de uso y la simplicidad, as? como la flexibilidad y la personalizaci?n. Esto significa que el usuario puede administrar los archivos exactamente de la manera que prefiera.</p>
    <p xml:lang="es">Caracter?sticas:</p>
    <ul>
      <li xml:lang="es">barra de navegaci?n (o de ruta completa) para URL que permite navegar r?pidamente a trav?s de la jerarqu?a de archivos y carpetas.</li>
      <li xml:lang="es">Admite varios tipos diferentes de estilos de vista y propiedades y permite configurar la vista exactamente como prefiera el usuario.</li>
      <li xml:lang="es">Dividir vista, para poder copiar o mover archivos f?cilmente entre distintas ubicaciones.</li>
      <li xml:lang="es">Hay disponible informaci?n adicional y accesos r?pidos en forma de paneles separables para que se puedan mover libremente a la vez que muestran exactamente lo que prefiera el usuario.</li>
      <li xml:lang="es">Admite varias pesta?as</li>
      <li xml:lang="es">Los di?logos informativos se muestran de manera discreta.</li>
      <li xml:lang="es">Admite las operaciones de deshacer y rehacer</li>
      <li xml:lang="es">Acceso transparente a la red a trav?s del sistema KIO.</li>
    </ul>
  </description>
  <pkgname>dolphin</pkgname>
  <categories>
    <category>System</category>
    <category>FileTools</category>
    <category>FileManager</category>
  </categories>
  <url type="homepage">https://dolphin.kde.org/</url>
  <url type="bugtracker">https://bugs.kde.org/enter_bug.cgi?format=guided&amp;product=dolphin</url>
  <url type="help">https://docs.kde.org/?application=dolphin</url>
  <icon type="cached" width="64" height="64">dolphin_system-file-manager.png</icon>
  <icon type="cached" width="128" height="128">dolphin_system-file-manager.png</icon>
  <icon type="stock">system-file-manager</icon>
  <launchable type="desktop-id">org.kde.dolphin.desktop</launchable>
  <screenshots>
    <screenshot type="default">
      <image type="source">https://kde.org/images/screenshots/dolphin.png</image>
    </screenshot>
  </screenshots>
  <mimetypes>
    <mimetype>inode/directory</mimetype>
  </mimetypes>
  <provides>
    <binary>dolphin</binary>
  </provides>
</component>

'LANG=es_ES plasma-discover' shows all descriptions in English, but 'LANG=es plasma-discover' shows them in Spanish.

@antonio-rojas
Copy link
Contributor Author

Looks like the problem is in the cache file. If I delete /var/cache/app-info/gv/es_ES.gvz it works. After recreating the cache it breaks again.

@antonio-rojas antonio-rojas changed the title Language variants not supported when reading metadata Translated metadata is not cached if locale contains country code Apr 3, 2018
antonio-rojas added a commit to antonio-rojas/appstream that referenced this issue Apr 3, 2018
If the component doesn't contain translated data for the given locale string, try the plain language string before falling back to C

Fixes ximion#166
ximion pushed a commit that referenced this issue Apr 3, 2018
* Check also plain language string in as_component_localized_get

If the component doesn't contain translated data for the given locale string, try the plain language string before falling back to C

Fixes #166
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants