Skip to content

CI4: Modify Weblate config to work with CI4 style language strings. #3468

Closed

Description

@objecttothis

Issue / Bug / Question / New Feature

Unlike CI3, CI4 ranges translation phrases into an associative array. I'm not sure of the ingest/export mechanism of Weblate but we may need to tweak the configuration so that translation files get generated properly.

image

Activity

  1. added this to the 3.4.0 milestone on Apr 12, 2022
  2. objecttothis commented on Apr 12, 2022

    @objecttothis
    MemberAuthor

    Also, currently only en-US language files in #3271 has been ported to the CI4 format. We need to figure out if we have to convert the rest of them by hand or if weblate can do this for us.

  3. jekkos commented on Apr 12, 2022

    @jekkos
    Member

    @objecttothis aren't the language files already associative arrays at this point? We have a lang variable (array) with key and assign a value to it. The syntax you show here will probably yield the same result?

  4. jekkos commented on Apr 12, 2022

    @jekkos
    Member

    I could look into this but preferably I'll try to match with what is in weblate as the current format nicely works.

  5. objecttothis commented on Apr 12, 2022

    @objecttothis
    MemberAuthor

    @objecttothis aren't the language files already associative arrays at this point? We have a lang variable (array) with key and assign a value to it. The syntax you show here will probably yield the same result?

    Sorry, you are correct. There are two things to consider though:

    1. In order to keep the CI3 styling we need to add return $lang;to the bottom of each file. Can we customize Weblate's generator to do this?
    2. By not adopting CI4 styling we could face hiccups later. In the end it's not a big deal because both are valid associative arrays, but it won't match CI documentation from here on out.

    #1 Is the only "must do" I think. If it's a lot of work to switch the array notation style in weblate then I'm ok with leaving it and adding the return statement. Let me know what you want to do.

  6. jekkos commented on Apr 13, 2022

    @jekkos
    Member

    @objecttothis I need to take some time to see how the file load mechanism works exactly. I suppose in the past CI was just loading one file and thus overwriting the keys with new values every time a language was selected.

    Do we keep the MY_Lang extension that we had in the old install or do we need to modify it? If we keep it then we can probably bootstrap the existing files and then we're also certain it will work with weblate. I wouldn't really worry too much about the CI convention here, as long as the strings go where they should.

    I'll be off coming week on a hiking trip, so I might not be able to look into this until after then.

  7. objecttothis commented on Apr 14, 2022

    @objecttothis
    MemberAuthor

    From https://codeigniter.com/user_guide/installation/upgrade_4xx.html
    image
    image

    https://codeigniter.com/user_guide/installation/upgrade_localization.html gives the details of upgrading localization. The extensions of localizations that we did in 3.x is one of the things that I am unfamiliar with. I'm certainly not opposed to extending and overriding CI4 functionality, but I don't think it's a good idea to do it just to avoid code rewrites because it opens the software up to difficulty upgrading in the future and potentially vulnerability patches that CI4 makes in x area that we aren't taking advantage of because we've overridden functionality in that area.

    That said, I haven't yet looked at porting the various framework extensions that we've made, so I guess we need to create an issue for that one too.

  8. jekkos commented on Apr 14, 2022

    @jekkos
    Member

    @objecttothis Good point indeed, let's not extend it unless there is no other way. I'll have to look in to the customization to see what it does exactly and will then check how to accomplish the same behavior in CI4.

    An easy fix for the language files would be to add an array declaration at the top of all the files, $lang = [] and a return $lang at the end.

  9. objecttothis commented on Apr 14, 2022

    @objecttothis
    MemberAuthor

    @objecttothis Good point indeed, let's not extend it unless there is no other way. I'll have to look in to the customization to see what it does exactly and will then check how to accomplish the same behavior in CI4.

    An easy fix for the language files would be to add an array declaration at the top of all the files, $lang = [] and a return $lang at the end.

    OK, let's see what ends up being needed. I converted all the files for en-US by hand already to the CI4 format, but that can be reverted if we find that Weblate cannot easily output that format for all the other languages and it's possible to use the CI3 formatting in CI4. It sounds like CI3 formatting could be made to work with your suggestion here.

  10. jekkos commented on May 1, 2022

    @jekkos
    Member

    I'lll try to have a look later this week.

  11. jekkos commented on Oct 19, 2022

    @jekkos
    Member

    @objecttothis it seems the CI4 format is also supported by weblate

  12. jekkos commented on Oct 19, 2022

    @jekkos
    Member

    Screenshot from 2022-10-19 21-09-41

  13. objecttothis commented on Oct 19, 2022

    @objecttothis
    MemberAuthor

    That's great news.

  14. 193 remaining items

  15. jekkos commented on Sep 8, 2024

    @jekkos
    Member

    Weblate should be setup to receive translation contributions on master.. seems the translation type was not set correctly yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions