lokalise / i18n-ally

🌍 All in one i18n extension for VS Code
https://marketplace.visualstudio.com/items?itemName=lokalise.i18n-ally
MIT License
3.92k stars 310 forks source link

Can you add support for INI files #146

Closed Serhioromano closed 4 years ago

Serhioromano commented 4 years ago

Is your feature related to a specific framework or general for this extension

Joomla

Describe the solution you'd like

I am a Joomla extension developer. Every Joomla extension can be translated. Locales are stored in languages/en-GB/extension_name.ini files. Very simple. In PHP code JText::_('KEY_TAG') is used for printing translations.

That would be awesome to have this support.

antfu commented 4 years ago

Sure! Can provide a minimal repo so that I can work on this better? Thanks

Serhioromano commented 4 years ago

https://github.com/joomla/joomla-cms

Go to folder language and administrator\language those are 2 i18n folders for backend and frontend. All extension's ini files are stored there.

In those folders first, you have older with language tags and inside that folder files. Every file starts with language tag and then you can identify the type of the file.

com* - component mod - module plg_ - plugin

But that is not as important.

antfu commented 4 years ago

@Serhioromano There is one more thing I may need your help.

The extension will read package.json(for node) or pubspec.yaml(for flutter) to check particular i18n packages exist or not. This makes it automatically adapt to different projects seamlessly.

I would like to know how to detect a project is a Joomla project and which packages make it supports i18n (or it has built-in support)

Thanks!

Serhioromano commented 4 years ago

There is only one way to detect that site is Joomla. User might delete all extra files and only index.php is not delitable. You can read its cotent and seatch for Joomla.Site in 3d line of the file.

<?php
/**
 * @package    Joomla.Site
 *
 * @copyright  Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 */

To get list of packages, you can read folders in /language folder. Every package is and actualy a folder. For instance.

For tests you can download

German http://joomlacode.org/gf/download/frsrelease/21248/165208/de-DE_joomla_lang_full_3.9.9v1.zip Russian http://joomlacode.org/gf/download/frsrelease/21068/164869/ru-RU_joomla_lang_full_3.9.1v5.zip

Unpuk it. Then create folders language/de-DE, administrator/language/de-DE and same for ru-RU. Then unpak site.zip to language folder and admin.zip to administrator/language.

antfu commented 4 years ago

@Serhioromano Joomla is now supported in v1.8.0. 🎉 Please check it out! Hope I made everything right.

Serhioromano commented 4 years ago

Oh! My goodness! I am on a way to check it. Wait for my review.

Serhioromano commented 4 years ago

I do not see anything, How to use it? I do not see any pannels. And when I try any command I see errors.

antfu commented 4 years ago

The extension we be looking for composer.json at the root of your project and see if there is 'joomla/application' dependency exists.

Do you have it?

Serhioromano commented 4 years ago

Ok, I've added this file. Now I see it. But it is a little bit confusing.

when I want to translate it insert all keys from all files into the current file. Is it possible that it keeps the structure. For instance if I want to translate to Russian from English, it creates similar files. If the language key was in language/en-GB/en-GB.com_contact.ini then you create language/ru-RU/ru-RU.com_contact.ini and instead of filling it empty you insert their English source text. Because it is impossible to translate by just looking to the language key. And it is impossible to search for every key just to look for content.

antfu commented 4 years ago

If the language key was in language/en-GB/en-GB.com_contact.ini then you create language/ru-RU/ru-RU.com_contact.ini

It's that the desired behavior?

instead of filling it empty you insert their English source text.

Sorry, I don't get it. Can you provide some example screenshots and steps to reproduce? Thanks.

Serhioromano commented 4 years ago

https://www.dropbox.com/s/xn3h2bv1bcbyqmn/translate.mp4?dl=0

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

antfu commented 4 years ago

Sorry I didn't got time to watch your video. I have just get back from my vacation. I can work on this now. Is the problem still presist?

Serhioromano commented 4 years ago

I think so. I did not work with Joomla lately.